//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldSupportOpenSSLOnSupportedPlatforms() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldSupportOpenSSLOnSupportedPlatforms() { // depends on the statically linked uber-jar with boring ssl: http://netty.io/wiki/forked-tomcat-native.html assumeTrue(SystemUtils.IS_OS_WINDOWS || SystemUtils.IS_OS_LINUX || SystemUtils.IS_OS_MAC_OSX); assumeThat(System.getProperty("os.arch"), equalTo("x86_64")); assumeThat(SystemUtils.JAVA_VENDOR, isOneOf("Oracle Corporation", "Sun Microsystems Inc.")); // given SslResource sslServerResource = selfSignedKeyId(0).trustKeyId(1).install(TestDir.directory("server")); SslResource sslClientResource = selfSignedKeyId(1).trustKeyId(0).install(TestDir.directory("client")); _server = new SecureServer(SslContextFactory.MakeSslPolicy(sslServerResource, SslProvider.OPENSSL)); _server.start(); _client = new SecureClient(SslContextFactory.MakeSslPolicy(sslClientResource, SslProvider.OPENSSL)); _client.connect(_server.port()); // when ByteBuf request = ByteBufAllocator.DEFAULT.buffer().writeBytes(_request); _client.channel().writeAndFlush(request); // then _expected = ByteBufAllocator.DEFAULT.buffer().writeBytes(SecureServer.Response); _client.sslHandshakeFuture().get(1, MINUTES); _client.assertResponse(_expected); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldBeAbleToRestartServer() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldBeAbleToRestartServer() { // Given string dataDirectory1 = _baseDir.directory("data1").AbsolutePath; string dataDirectory2 = _baseDir.directory("data2").AbsolutePath; Config config = Config.fromFile(EnterpriseServerBuilder.serverOnRandomPorts().withDefaultDatabaseTuning().usingDataDir(dataDirectory1).createConfigFiles()).withHome(_baseDir.directory()).withSetting(GraphDatabaseSettings.logs_directory, _baseDir.directory("logs").Path).build(); // When NeoServer server = _cleanup.add(new OpenEnterpriseNeoServer(config, GraphDbDependencies())); server.Start(); assertNotNull(server.Database.Graph); assertEquals(config.Get(GraphDatabaseSettings.database_path).AbsolutePath, server.Database.Location.AbsolutePath); // Change the database location config.Augment(GraphDatabaseSettings.data_directory, dataDirectory2); ServerManagement bean = new ServerManagement(server); bean.RestartServer(); // Then assertNotNull(server.Database.Graph); assertEquals(config.Get(GraphDatabaseSettings.database_path).AbsolutePath, server.Database.Location.AbsolutePath); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void givenExplicitlyDisabledServerLoggingConfigurationShouldNotLogAccesses() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void GivenExplicitlyDisabledServerLoggingConfigurationShouldNotLogAccesses() { // given string directoryPrefix = _testName.MethodName; File logDirectory = _testDirectory.directory(directoryPrefix + "-logdir"); NeoServer server = serverOnRandomPorts().withDefaultDatabaseTuning().persistent().withProperty(ServerSettings.http_logging_enabled.name(), Settings.FALSE).withProperty(GraphDatabaseSettings.logs_directory.name(), logDirectory.ToString()).withProperty((new BoltConnector("bolt")).listen_address.name(), ":0").usingDataDir(_testDirectory.directory(directoryPrefix + "-dbdir").AbsolutePath).build(); try { server.Start(); FunctionalTestHelper functionalTestHelper = new FunctionalTestHelper(server); // when string query = "?implicitlyDisabled" + RandomString(); JaxRsResponse response = (new RestRequest()).get(functionalTestHelper.ManagementUri() + query); assertThat(response.Status, @is(HttpStatus.SC_OK)); response.Close(); // then File httpLog = new File(logDirectory, "http.log"); assertThat(httpLog.exists(), @is(false)); } finally { server.Stop(); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Before public void setup() public virtual void Setup() { _homeDir = _testDir.directory("home").toPath(); _confDir = _testDir.directory("conf").toPath(); _fs.mkdir(_homeDir.toFile()); when(_outsideWorld.fileSystem()).thenReturn(_fs); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Before public void setup() public virtual void Setup() { this._fileCopyDetector = new FileCopyDetector(); _backupCluster = new EnterpriseCluster(_testDir.directory("cluster-for-backup"), 3, 0, new SharedDiscoveryServiceFactory(), emptyMap(), emptyMap(), emptyMap(), emptyMap(), Standard.LATEST_NAME, IpFamily.IPV4, false); _cluster = new EnterpriseCluster(_testDir.directory("cluster-b"), 3, 0, new SharedDiscoveryServiceFactory(), emptyMap(), emptyMap(), emptyMap(), emptyMap(), Standard.LATEST_NAME, IpFamily.IPV4, false); _baseBackupDir = _testDir.directory("backups"); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void storeLayoutResolvesLinks() throws java.io.IOException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: internal virtual void StoreLayoutResolvesLinks() { Path basePath = _testDirectory.directory().toPath(); File storeDir = _testDirectory.storeDir("notAbsolute"); Path linkPath = basePath.resolve("link"); Path symbolicLink = Files.createSymbolicLink(linkPath, storeDir.toPath()); StoreLayout storeLayout = StoreLayout.Of(symbolicLink.toFile()); assertEquals(storeDir, storeLayout.StoreDirectory()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void shouldGiveAClearErrorIfTheArchiveAlreadyExists() throws java.io.IOException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: internal virtual void ShouldGiveAClearErrorIfTheArchiveAlreadyExists() { Path directory = _testDirectory.directory("a-directory").toPath(); Path archive = _testDirectory.file("the-archive.dump").toPath(); Files.write(archive, new sbyte[0]); FileAlreadyExistsException exception = assertThrows(typeof(FileAlreadyExistsException), () => (new Dumper()).dump(directory, directory, archive, GZIP, Predicates.alwaysFalse())); assertEquals(archive.ToString(), exception.Message); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @BeforeEach void setUp() internal virtual void SetUp() { _homeDir = _testDirectory.directory("home-dir").toPath(); _configDir = _testDirectory.directory("config-dir").toPath(); _archive = _testDirectory.directory("some-archive.dump").toPath(); _loader = mock(typeof(Loader)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldRotateOnAppendWhenRotateSizeIsReached() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldRotateOnAppendWhenRotateSizeIsReached() { // When SegmentedRaftLog log = _life.add(CreateRaftLog(ROTATE_AT_SIZE_IN_BYTES)); log.Append(new RaftLogEntry(0, ReplicatedStringOfBytes(ROTATE_AT_SIZE_IN_BYTES))); // Then File[] files = _fileSystemRule.get().listFiles(_testDirectory.directory(), (dir, name) => name.StartsWith("raft")); assertEquals(2, Files.Length); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldWriteToInternalDiagnosticsLog() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldWriteToInternalDiagnosticsLog() { // Given (new TestGraphDatabaseFactory()).newEmbeddedDatabaseBuilder(TestDir.databaseDir()).setConfig(GraphDatabaseSettings.logs_directory, TestDir.directory("logs").AbsolutePath).newGraphDatabase().shutdown(); File internalLog = new File(TestDir.directory("logs"), INTERNAL_LOG_FILE); // Then assertThat(internalLog.File, @is(true)); assertThat(internalLog.length(), greaterThan(0L)); assertEquals(1, CountOccurrences(internalLog, "Database graph.db is ready.")); assertEquals(2, CountOccurrences(internalLog, "Database graph.db is unavailable.")); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldBeAbleToRecoverBrokenStoreWithLogsInSeparateAbsoluteLocation() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldBeAbleToRecoverBrokenStoreWithLogsInSeparateAbsoluteLocation() { File customTransactionLogsLocation = _testDirectory.directory("tx-logs"); Config config = Config.defaults(logical_logs_location, customTransactionLogsLocation.AbsolutePath); RecoverBrokenStoreWithConfig(config); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @ParameterizedTest @ValueSource(ints = {7, 11, 14, 20, 35, 58}) void partitionedIndexPopulation(int affectedNodes) throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: internal virtual void PartitionedIndexPopulation(int affectedNodes) { File rootFolder = new File(_testDir.directory("partitionIndex" + affectedNodes), "uniqueIndex" + affectedNodes); using (SchemaIndex uniqueIndex = LuceneSchemaIndexBuilder.create(_descriptor, Config.defaults()).withFileSystem(_fileSystem).withIndexRootFolder(rootFolder).build()) { uniqueIndex.open(); // index is empty and not yet exist assertEquals(0, uniqueIndex.allDocumentsReader().maxCount()); assertFalse(uniqueIndex.exists()); using (LuceneIndexAccessor indexAccessor = new LuceneIndexAccessor(uniqueIndex, _descriptor)) { GenerateUpdates(indexAccessor, affectedNodes); indexAccessor.Force(Org.Neo4j.Io.pagecache.IOLimiter_Fields.Unlimited); // now index is online and should contain updates data assertTrue(uniqueIndex.Online); using (IndexReader indexReader = indexAccessor.NewReader(), IndexSampler indexSampler = indexReader.CreateSampler()) { long[] nodes = PrimitiveLongCollections.asArray(indexReader.Query(IndexQuery.exists(1))); assertEquals(affectedNodes, nodes.Length); IndexSample sample = indexSampler.SampleIndex(); assertEquals(affectedNodes, sample.IndexSize()); assertEquals(affectedNodes, sample.UniqueValues()); assertEquals(affectedNodes, sample.SampleSize()); } } } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void logicForMovingBackupsIsDelegatedToFileMovePropagator() throws java.io.IOException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void LogicForMovingBackupsIsDelegatedToFileMovePropagator() { // given Path parentDirectory = TestDirectory.directory("parent").toPath(); Path oldLocation = parentDirectory.resolve("oldLocation"); Files.createDirectories(oldLocation); Path newLocation = parentDirectory.resolve("newLocation"); // and FileMoveAction fileOneMoveAction = mock(typeof(FileMoveAction)); FileMoveAction fileTwoMoveAction = mock(typeof(FileMoveAction)); when(_fileMoveProvider.traverseForMoving(any())).thenReturn(Stream.of(fileOneMoveAction, fileTwoMoveAction)); // when Subject.moveBackupLocation(oldLocation, newLocation); // then file move propagator was requested with correct source and baseDirectory verify(_fileMoveProvider).traverseForMoving(oldLocation.toFile()); // and files were moved to correct target directory verify(fileOneMoveAction).move(newLocation.toFile()); verify(fileTwoMoveAction).move(newLocation.toFile()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void shouldPersistFulltextIndexSettings() throws java.io.IOException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: internal virtual void ShouldPersistFulltextIndexSettings() { // Given File indexFolder = Directory.directory("indexFolder"); string analyzerName = "simple"; string eventuallyConsistency = "true"; string defaultAnalyzer = "defaultAnalyzer"; int[] propertyIds = new int[] { 1, 2, 3 }; MultiTokenSchemaDescriptor schema = SchemaDescriptorFactory.multiToken(new int[] { 1, 2 }, EntityType.NODE, propertyIds); // A fulltext index descriptor with configurations Properties properties = properties(analyzerName, eventuallyConsistency); FulltextSchemaDescriptor fulltextSchemaDescriptor = new FulltextSchemaDescriptor(schema, properties); StoreIndexDescriptor storeIndexDescriptor = StoreIndexDescriptorFromSchema(fulltextSchemaDescriptor); TokenRegistry tokenRegistry = SimpleTokenHolder.CreatePopulatedTokenRegistry(Org.Neo4j.Kernel.impl.core.TokenHolder_Fields.TYPE_PROPERTY_KEY, propertyIds); SimpleTokenHolder tokenHolder = new SimpleTokenHolder(tokenRegistry); FulltextIndexDescriptor fulltextIndexDescriptor = readOrInitialiseDescriptor(storeIndexDescriptor, defaultAnalyzer, tokenHolder, indexFolder, Fs); assertEquals(analyzerName, fulltextIndexDescriptor.AnalyzerName()); assertEquals(bool.Parse(eventuallyConsistency), fulltextIndexDescriptor.EventuallyConsistent); // When persisting it FulltextIndexSettings.SaveFulltextIndexSettings(fulltextIndexDescriptor, indexFolder, Fs); // Then we should be able to load it back with settings being the same StoreIndexDescriptor loadingIndexDescriptor = StoreIndexDescriptorFromSchema(schema); FulltextIndexDescriptor loadedDescriptor = readOrInitialiseDescriptor(loadingIndexDescriptor, defaultAnalyzer, tokenHolder, indexFolder, Fs); assertEquals(fulltextIndexDescriptor.AnalyzerName(), loadedDescriptor.AnalyzerName()); assertEquals(fulltextIndexDescriptor.EventuallyConsistent, loadedDescriptor.EventuallyConsistent); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void runsConsistencyChecker() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: internal virtual void RunsConsistencyChecker() { ConsistencyCheckService consistencyCheckService = mock(typeof(ConsistencyCheckService)); Path homeDir = _testDir.directory("home").toPath(); File databasesFolder = GetDatabasesFolder(homeDir); CheckConsistencyCommand checkConsistencyCommand = new CheckConsistencyCommand(homeDir, _testDir.directory("conf").toPath(), consistencyCheckService); DatabaseLayout databaseLayout = DatabaseLayout.of(databasesFolder, "mydb"); when(consistencyCheckService.runFullConsistencyCheck(eq(databaseLayout), any(typeof(Config)), any(typeof(ProgressMonitorFactory)), any(typeof(LogProvider)), any(typeof(FileSystemAbstraction)), eq(false), any(), any(typeof(ConsistencyFlags)))).thenReturn(ConsistencyCheckService.Result.success(null)); checkConsistencyCommand.Execute(new string[] { "--database=mydb" }); verify(consistencyCheckService).runFullConsistencyCheck(eq(databaseLayout), any(typeof(Config)), any(typeof(ProgressMonitorFactory)), any(typeof(LogProvider)), any(typeof(FileSystemAbstraction)), eq(false), any(), any(typeof(ConsistencyFlags))); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldLaunchAServerInSpecifiedDirectory() public virtual void ShouldLaunchAServerInSpecifiedDirectory() { // Given File workDir = new File(TestDir.directory(), "specific"); workDir.mkdir(); // When using (ServerControls server = GetTestServerBuilder(workDir).newServer()) { // Then assertThat(HTTP.GET(server.HttpURI().ToString()).status(), equalTo(200)); assertThat(workDir.list().length, equalTo(1)); } // And after it's been closed, it should've cleaned up after itself. assertThat(Arrays.ToString(workDir.list()), workDir.list().length, equalTo(0)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldPersistAndRecoverState() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldPersistAndRecoverState() { // given EphemeralFileSystemAbstraction fsa = FileSystemRule.get(); fsa.Mkdir(TestDir.directory()); StateMarshal <ReplicatedLockTokenState> marshal = new ReplicatedLockTokenState.Marshal(new MemberId.Marshal()); MemberId memberA = member(0); MemberId memberB = member(1); int candidateId; DurableStateStorage <ReplicatedLockTokenState> storage = new DurableStateStorage <ReplicatedLockTokenState>(fsa, TestDir.directory(), "state", marshal, 100, NullLogProvider.Instance); using (Lifespan lifespan = new Lifespan(storage)) { ReplicatedLockTokenStateMachine stateMachine = new ReplicatedLockTokenStateMachine(storage); // when candidateId = 0; stateMachine.ApplyCommand(new ReplicatedLockTokenRequest(memberA, candidateId), 0, r => { }); candidateId = 1; stateMachine.ApplyCommand(new ReplicatedLockTokenRequest(memberB, candidateId), 1, r => { }); stateMachine.Flush(); fsa.Crash(); } // then DurableStateStorage <ReplicatedLockTokenState> storage2 = new DurableStateStorage <ReplicatedLockTokenState>(fsa, TestDir.directory(), "state", marshal, 100, NullLogProvider.Instance); using (Lifespan lifespan = new Lifespan(storage2)) { ReplicatedLockTokenState initialState = storage2.InitialState; assertEquals(memberB, initialState.Get().owner()); assertEquals(candidateId, initialState.Get().id()); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Before public void setup() public virtual void Setup() { _fileSystem = _fileSystemRule.get(); OutsideWorld mock = mock(typeof(OutsideWorld)); when(mock.FileSystem()).thenReturn(_fileSystem); _setPasswordCommand = new SetInitialPasswordCommand(_testDir.directory("home").toPath(), _testDir.directory("conf").toPath(), mock); _authInitFile = CommunitySecurityModule.getInitialUserRepositoryFile(_setPasswordCommand.loadNeo4jConfig()); CommunitySecurityModule.getUserRepositoryFile(_setPasswordCommand.loadNeo4jConfig()); }
//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() { Path homeDir = TestDirectory.directory("home-dir").toPath(); _databaseDirectory = homeDir.resolve("data/databases/foo.db"); Files.createDirectories(_databaseDirectory); _outCaptor = ArgumentCaptor.forClass(typeof(string)); @out = mock(typeof(System.Action)); _command = new StoreInfoCommand(@out); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Before public void setUp() public virtual void SetUp() { File txLogLocation = new File(TestDirectory.directory(), "txLogLocation"); _config = Config.builder().withSetting(GraphDatabaseSettings.logical_logs_location, txLogLocation.AbsolutePath).build(); File storeDir = TestDirectory.storeDir(); _databaseLayout = DatabaseLayout.of(storeDir, _config.get(GraphDatabaseSettings.active_database)); _fsa = TestDirectory.FileSystem; _commitStateHelper = new CommitStateHelper(PageCacheRule.getPageCache(_fsa), _fsa, _config); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void shouldCreateASelfSignedCertificate() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: internal virtual void ShouldCreateASelfSignedCertificate() { // Given PkiUtils sslFactory = new PkiUtils(); File cPath = new File(_testDirectory.directory(), "certificate"); File pkPath = new File(_testDirectory.directory(), "key"); // When sslFactory.CreateSelfSignedCertificate(cPath, pkPath, "myhost"); // Then // Attempt to load certificate Certificate[] certificates = sslFactory.LoadCertificates(cPath); assertThat(certificates.Length, @is(greaterThan(0))); // Attempt to load private key PrivateKey pk = sslFactory.LoadPrivateKey(pkPath); assertThat(pk, notNullValue()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void verifyChunkingArrayWithPageCacheLongArray() public virtual void VerifyChunkingArrayWithPageCacheLongArray() { PageCache pageCache = _pageCacheRule.getPageCache(_fs); File directory = _dir.directory(); NumberArrayFactory numberArrayFactory = NumberArrayFactory.auto(pageCache, directory, false, NumberArrayFactory_Fields.NoMonitor); using (LongArray array = numberArrayFactory.NewDynamicLongArray(COUNT / 1_000, 0)) { VerifyBehaviour(array); } }
private SegmentedRaftLog CreateRaftLog(long rotateAtSize) { File directory = new File(RAFT_LOG_DIRECTORY_NAME); _logDirectory = Dir.directory(directory.Name); LogProvider logProvider = Instance; CoreLogPruningStrategy pruningStrategy = (new CoreLogPruningStrategyFactory("100 entries", logProvider)).NewInstance(); return(new SegmentedRaftLog(FsRule.get(), _logDirectory, rotateAtSize, CoreReplicatedContentMarshal.marshaller(), logProvider, 8, Clocks.fakeClock(), new OnDemandJobScheduler(), pruningStrategy)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldBootAndShutdownCluster() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldBootAndShutdownCluster() { Path clusterPath = TestDirectory.directory().toPath(); CausalClusterInProcessBuilder.PortPickingStrategy portPickingStrategy = new PortAuthorityPortPickingStrategy(); CausalClusterInProcessBuilder.CausalCluster cluster = CausalClusterInProcessBuilder.Init().withCores(3).withReplicas(3).withLogger(NullLogProvider.Instance).atPath(clusterPath).withOptionalPortsStrategy(portPickingStrategy).build(); cluster.Boot(); cluster.Shutdown(); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void partiesWithMutualTrustShouldCommunicate() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void PartiesWithMutualTrustShouldCommunicate() { // given SslResource sslServerResource = selfSignedKeyId(0).trustKeyId(1).install(TestDir.directory("server")); SslResource sslClientResource = selfSignedKeyId(1).trustKeyId(0).install(TestDir.directory("client")); _server = new SecureServer(SslContextFactory.MakeSslPolicy(sslServerResource)); _server.start(); _client = new SecureClient(SslContextFactory.MakeSslPolicy(sslClientResource)); _client.connect(_server.port()); // when ByteBuf request = ByteBufAllocator.DEFAULT.buffer().writeBytes(_request); _client.channel().writeAndFlush(request); // then _expected = ByteBufAllocator.DEFAULT.buffer().writeBytes(SecureServer.Response); _client.sslHandshakeFuture().get(1, MINUTES); _client.assertResponse(_expected); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Before public void setup() throws java.io.IOException, org.neo4j.kernel.api.exceptions.InvalidArgumentsException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void Setup() { OutsideWorld mock = mock(typeof(OutsideWorld)); when(mock.FileSystem()).thenReturn(_fileSystem); _setDefaultAdmin = new SetDefaultAdminCommand(TestDir.directory("home").toPath(), TestDir.directory("conf").toPath(), mock); _config = _setDefaultAdmin.loadNeo4jConfig(); UserRepository users = CommunitySecurityModule.getUserRepository(_config, NullLogProvider.Instance, _fileSystem); users.create(new User.Builder("jake", LegacyCredential.forPassword("123")) .withRequiredPasswordChange(false).build()); _adminIniFile = new File(CommunitySecurityModule.getUserRepositoryFile(_config).ParentFile, "admin.ini"); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldFailIfFileDoesNotExist() public virtual void ShouldFailIfFileDoesNotExist() { // given File missingFile = new File(_directory.directory(), "missing-file"); PageCache pageCache = _pageCacheRule.getPageCache(_fileSystemRule.get()); StoreVersionCheck storeVersionCheck = new StoreVersionCheck(pageCache); // when StoreVersionCheck.Result result = storeVersionCheck.HasVersion(missingFile, "version"); // then assertFalse(result.Outcome.Successful); assertEquals(StoreVersionCheck.Result.Outcome.MissingStoreFile, result.Outcome); assertNull(result.ActualVersion); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void nonPageCacheFilesMovedDoNotLeaveOriginal() throws java.io.IOException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void NonPageCacheFilesMovedDoNotLeaveOriginal() { // given File baseDirectory = TestDirectory.directory(); File sourceDirectory = new File(baseDirectory, "source"); File targetDirectory = new File(baseDirectory, "destination"); File sourceFile = new File(sourceDirectory, "theFileName"); File targetFile = new File(targetDirectory, "theFileName"); sourceFile.ParentFile.mkdirs(); targetDirectory.mkdirs(); // and sanity check assertTrue(sourceFile.createNewFile()); assertTrue(sourceFile.exists()); assertFalse(targetFile.exists()); // when FileMoveAction.moveViaFileSystem(sourceFile, sourceDirectory).move(targetDirectory); // then assertTrue(targetFile.exists()); assertFalse(sourceFile.exists()); }
//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(); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldMonitorBolt() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldMonitorBolt() { // Given File metricsFolder = TestDirectory.directory("metrics"); _db = ( GraphDatabaseAPI )(new TestGraphDatabaseFactory()).newEmbeddedDatabaseBuilder(TestDirectory.storeDir()).setConfig((new BoltConnector("bolt")).type, "BOLT").setConfig((new BoltConnector("bolt")).enabled, "true").setConfig((new BoltConnector("bolt")).listen_address, "localhost:0").setConfig(GraphDatabaseSettings.auth_enabled, "false").setConfig(MetricsSettings.MetricsEnabled, "false").setConfig(MetricsSettings.BoltMessagesEnabled, "true").setConfig(MetricsSettings.CsvEnabled, "true").setConfig(MetricsSettings.CsvInterval, "100ms").setConfig(MetricsSettings.CsvPath, metricsFolder.AbsolutePath).setConfig(OnlineBackupSettings.online_backup_enabled, Settings.FALSE).newGraphDatabase(); // When _conn = (new SocketConnection()).connect(new HostnamePort("localhost", getBoltPort(_db))).send(_util.acceptedVersions(1, 0, 0, 0)).send(_util.chunk(new InitMessage("TestClient", map("scheme", "basic", "principal", "neo4j", "credentials", "neo4j")))); // Then assertEventually("session shows up as started", () => readLongValue(metricsCsv(metricsFolder, SESSIONS_STARTED)), equalTo(1L), 5, SECONDS); assertEventually("init request shows up as received", () => readLongValue(metricsCsv(metricsFolder, MESSAGES_RECEIVED)), equalTo(1L), 5, SECONDS); assertEventually("init request shows up as started", () => readLongValue(metricsCsv(metricsFolder, MESSAGES_STARTED)), equalTo(1L), 5, SECONDS); assertEventually("init request shows up as done", () => readLongValue(metricsCsv(metricsFolder, MESSAGES_DONE)), equalTo(1L), 5, SECONDS); assertEventually("queue time shows up", () => readLongValue(metricsCsv(metricsFolder, TOTAL_QUEUE_TIME)), greaterThanOrEqualTo(0L), 5, SECONDS); assertEventually("processing time shows up", () => readLongValue(metricsCsv(metricsFolder, TOTAL_PROCESSING_TIME)), greaterThanOrEqualTo(0L), 5, SECONDS); }