//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldBeAbleToUpgradeAStoreWithoutIdFilesAsBackups() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldBeAbleToUpgradeAStoreWithoutIdFilesAsBackups() { File databaseDirectory = Store.prepareDirectory(TestDir.databaseDir()); // remove id files File[] idFiles = databaseDirectory.listFiles((dir1, name) => name.EndsWith(".id")); foreach (File idFile in idFiles) { assertTrue(idFile.delete()); } GraphDatabaseFactory factory = new TestGraphDatabaseFactory(); GraphDatabaseBuilder builder = factory.NewEmbeddedDatabaseBuilder(TestDir.databaseDir()); builder.SetConfig(GraphDatabaseSettings.allow_upgrade, "true"); builder.SetConfig(GraphDatabaseSettings.record_format, Store.FormatFamily); builder.SetConfig(OnlineBackupSettings.online_backup_enabled, Settings.FALSE); GraphDatabaseService db = builder.NewGraphDatabase(); try { CheckInstance(Store, ( GraphDatabaseAPI )db); } finally { Db.shutdown(); } assertConsistentStore(DatabaseLayout.of(databaseDirectory)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Before public void setUp() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void SetUp() { _storeDir = _directory.databaseDir(); _monitors.addMonitorListener(_recoveryMonitor); _databaseFactory = (new TestGraphDatabaseFactory()).setInternalLogProvider(_logProvider).setMonitors(_monitors); _logFiles = BuildDefaultLogFiles(); }
private GraphDatabaseService GraphDatabaseService(Config config) { TestGraphDatabaseFactory factory = new TestGraphDatabaseFactory(); factory.FileSystem = _fileSystemRule.get(); return(factory.NewImpermanentDatabaseBuilder(_storeDir.databaseDir()).setConfig(config.Raw).newGraphDatabase()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @BeforeClass public static void setUp() public static void SetUp() { TestGraphDatabaseFactory factory = new TestGraphDatabaseFactory(); _logProvider = new AssertableLogProvider(true); factory.InternalLogProvider = _logProvider; _database = factory.NewEmbeddedDatabase(Directory.storeDir()); _executorService = Executors.newCachedThreadPool(); }
private GraphDatabaseService StartDatabase(bool allowUpgrade) { GraphDatabaseFactory factory = new TestGraphDatabaseFactory(); GraphDatabaseBuilder builder = factory.NewEmbeddedDatabaseBuilder(TestDir.databaseDir()); builder.SetConfig(GraphDatabaseSettings.allow_upgrade, Convert.ToString(allowUpgrade)); builder.SetConfig(GraphDatabaseSettings.pagecache_memory, "8m"); builder.SetConfig(OnlineBackupSettings.online_backup_enabled, Settings.FALSE); return(builder.NewGraphDatabase()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void migratingOlderDataAndThanStartAClusterUsingTheNewerDataShouldWork() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void MigratingOlderDataAndThanStartAClusterUsingTheNewerDataShouldWork() { // migrate the store using a single instance File storeDir = TestDir.storeDir("initialData"); File databaseDirectory = Store.prepareDirectory(TestDir.databaseDir(storeDir)); GraphDatabaseFactory factory = new TestGraphDatabaseFactory(); GraphDatabaseBuilder builder = factory.NewEmbeddedDatabaseBuilder(databaseDirectory); builder.SetConfig(GraphDatabaseSettings.allow_upgrade, "true"); builder.SetConfig(GraphDatabaseSettings.pagecache_memory, "8m"); builder.setConfig(GraphDatabaseSettings.logs_directory, TestDir.directory("logs").AbsolutePath); builder.SetConfig(OnlineBackupSettings.online_backup_enabled, Settings.FALSE); GraphDatabaseService db = builder.NewGraphDatabase(); try { CheckInstance(Store, ( GraphDatabaseAPI )db); } finally { Db.shutdown(); } assertConsistentStore(DatabaseLayout.of(databaseDirectory)); // start the cluster with the db migrated from the old instance File haDir = TestDir.storeDir("ha-stuff"); ClusterManager clusterManager = (new ClusterManager.Builder(haDir)).withSeedDir(databaseDirectory).withCluster(clusterOfSize(2)).build(); HighlyAvailableGraphDatabase master; HighlyAvailableGraphDatabase slave; try { clusterManager.Start(); ClusterManager.ManagedCluster cluster = clusterManager.Cluster; cluster.Await(allSeesAllAsAvailable()); master = cluster.Master; CheckInstance(Store, master); slave = cluster.AnySlave; CheckInstance(Store, slave); clusterManager.SafeShutdown(); assertConsistentStore(master.DatabaseLayout()); assertConsistentStore(slave.DatabaseLayout()); } finally { clusterManager.SafeShutdown(); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Before public void before() throws org.neo4j.internal.kernel.api.exceptions.schema.MisconfiguredIndexException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void Before() { when(_mockedIndexProvider.ProviderDescriptor).thenReturn(PROVIDER_DESCRIPTOR); when(_mockedIndexProvider.storeMigrationParticipant(any(typeof(FileSystemAbstraction)), any(typeof(PageCache)))).thenReturn(Org.Neo4j.Kernel.impl.storemigration.StoreMigrationParticipant_Fields.NotParticipating); when(_mockedIndexProvider.bless(any(typeof(IndexDescriptor)))).thenCallRealMethod(); TestGraphDatabaseFactory factory = new TestGraphDatabaseFactory(); factory.FileSystem = Fs.get(); factory.KernelExtensions = Collections.singletonList(_mockedIndexProviderFactory); _db = ( GraphDatabaseAPI )factory.NewImpermanentDatabaseBuilder().setConfig(default_schema_provider, PROVIDER_DESCRIPTOR.name()).newGraphDatabase(); _ctxSupplier = _db.DependencyResolver.resolveDependency(typeof(ThreadToStatementContextBridge)); }
private void StartDb <T1>(KernelExtensionFactory <T1> indexProviderFactory) { if (_db != null) { _db.shutdown(); } TestGraphDatabaseFactory factory = new TestGraphDatabaseFactory(); factory.FileSystem = Fs.get(); factory.KernelExtensions = Collections.singletonList(indexProviderFactory); _db = ( GraphDatabaseAPI )factory.NewImpermanentDatabaseBuilder().setConfig(default_schema_provider, PROVIDER_DESCRIPTOR.name()).newGraphDatabase(); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void migrationShouldFail() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void MigrationShouldFail() { // migrate the store using a single instance File databaseDirectory = Unzip.unzip(this.GetType(), DbFileName, TestDir.databaseDir()); (new File(databaseDirectory, "debug.log")).delete(); // clear the log GraphDatabaseFactory factory = new TestGraphDatabaseFactory(); GraphDatabaseBuilder builder = factory.NewEmbeddedDatabaseBuilder(TestDir.databaseDir()); builder.SetConfig(GraphDatabaseSettings.allow_upgrade, "true"); builder.SetConfig(GraphDatabaseSettings.pagecache_memory, "8m"); try { builder.NewGraphDatabase(); fail("It should have failed."); } catch (Exception ex) { assertTrue(ex.InnerException is LifecycleException); Exception realException = ex.InnerException.InnerException; assertTrue("Unexpected exception", Exceptions.contains(realException, typeof(StoreUpgrader.UnexpectedUpgradingStoreVersionException))); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void embeddedDatabaseShouldStartOnOlderStoreWhenUpgradeIsEnabled() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void EmbeddedDatabaseShouldStartOnOlderStoreWhenUpgradeIsEnabled() { File databaseDirectory = Store.prepareDirectory(TestDir.databaseDir()); GraphDatabaseFactory factory = new TestGraphDatabaseFactory(); GraphDatabaseBuilder builder = factory.NewEmbeddedDatabaseBuilder(TestDir.databaseDir()); builder.SetConfig(GraphDatabaseSettings.allow_upgrade, "true"); builder.SetConfig(GraphDatabaseSettings.pagecache_memory, "8m"); builder.setConfig(GraphDatabaseSettings.logs_directory, TestDir.directory("logs").AbsolutePath); builder.SetConfig(OnlineBackupSettings.online_backup_enabled, Settings.FALSE); GraphDatabaseService db = builder.NewGraphDatabase(); try { CheckInstance(Store, ( GraphDatabaseAPI )db); } finally { Db.shutdown(); } assertConsistentStore(DatabaseLayout.of(databaseDirectory)); }
protected internal virtual TestGraphDatabaseFactory Configure(TestGraphDatabaseFactory factory) { return(factory); }
protected internal override GraphDatabaseFactory newFactory() { TestGraphDatabaseFactory factory = new TestGraphDatabaseFactory(); return(factory.AddKernelExtension(index)); }
protected internal TestGraphDatabaseFactory MaybeSetInternalLogProvider(TestGraphDatabaseFactory factory) { return((_internalLogProvider == null) ? factory : factory.setInternalLogProvider(_internalLogProvider)); }