Пример #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldErrorIfRealUsersAlreadyExistV2() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldErrorIfRealUsersAlreadyExistV2()
        {
            // Given
            // Create an `auth` file with the default neo4j user, but not the default password
            _tool.execute(_homeDir.toPath(), _confDir.toPath(), SET_PASSWORD, "not-the-default-password");
            File authFile = GetAuthFile("auth");

            _fileSystem.mkdirs(authFile.ParentFile);
            _fileSystem.renameFile(GetAuthFile("auth.ini"), authFile);

            // When
            _tool.execute(_homeDir.toPath(), _confDir.toPath(), SET_PASSWORD, "will-be-ignored");

            // Then
            AssertNoAuthIniFile();
            verify(@out, times(1)).stdErrLine("command failed: the provided initial password was not set because existing Neo4j users were " + "detected at `" + authFile.AbsolutePath + "`. Please remove the existing `auth` file if you " + "want to reset your database to only have a default user with the provided password.");
            verify(@out).exit(1);

            verify(@out, times(1)).stdOutLine("Changed password for user 'neo4j'.");                     // This is from the initial setup
        }