Example #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void rebuildReplicatedIdGeneratorsOnRecovery() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void RebuildReplicatedIdGeneratorsOnRecovery()
        {
            DefaultFileSystemAbstraction fileSystem = FileSystemRule.get();
            File stickyGenerator      = new File(TestDirectory.databaseDir(), "stickyGenerator");
            File nodeStoreIdGenerator = TestDirectory.databaseLayout().idNodeStore();

            StoreFactory storeFactory = new StoreFactory(TestDirectory.databaseLayout(), Config.defaults(), GetIdGenerationFactory(fileSystem), PageCacheRule.getPageCache(fileSystem), fileSystem, NullLogProvider.Instance, EmptyVersionContextSupplier.EMPTY);

            using (NeoStores neoStores = storeFactory.OpenAllNeoStores(true))
            {
                NodeStore nodeStore = neoStores.NodeStore;
                for (int i = 0; i < 50; i++)
                {
                    NodeRecord nodeRecord = nodeStore.NewRecord();
                    nodeRecord.InUse = true;
                    nodeRecord.Id    = nodeStore.NextId();
                    if (i == 47)
                    {
                        FileUtils.copyFile(nodeStoreIdGenerator, stickyGenerator);
                    }
                    nodeStore.UpdateRecord(nodeRecord);
                }
            }

            FileUtils.copyFile(stickyGenerator, nodeStoreIdGenerator);
            using (NeoStores reopenedStores = storeFactory.OpenAllNeoStores())
            {
                reopenedStores.MakeStoreOk();
                assertEquals(51L, reopenedStores.NodeStore.nextId());
            }
        }
Example #2
0
//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()
        {
            _home = TestDirectory.directory("home");
            File baseDir = new File(_home, "certificates/default");

            _publicCertificateFile = new File(baseDir, "public.crt");
            _privateKeyFile        = new File(baseDir, "private.key");

            (new PkiUtils()).createSelfSignedCertificate(_publicCertificateFile, _privateKeyFile, "localhost");

            File trustedDir = new File(baseDir, "trusted");

            trustedDir.mkdir();
            FileUtils.copyFile(_publicCertificateFile, new File(trustedDir, "public.crt"));
            (new File(baseDir, "revoked")).mkdir();
        }