コード例 #1
0
ファイル: DumpCreatorTests.cs プロジェクト: gavz/MemAnalyzer
        public void Can_Parse_SinglePidArg()
        {
            string[] args = new string[] { "5000" };
            int      pid  = DumpCreator.FindPidInProcDumpArgs(args, out string exeName);

            Assert.AreEqual(5000, pid);
        }
コード例 #2
0
ファイル: DumpCreatorTests.cs プロジェクト: gavz/MemAnalyzer
        public void ExeFilePresent_DumpFileNot()
        {
            string[] args = new string[] { "-ma", "notepad" };
            int      pid  = DumpCreator.FindPidInProcDumpArgs(args, out string exeName);

            Assert.AreEqual("notepad", exeName);
        }
コード例 #3
0
ファイル: DumpCreatorTests.cs プロジェクト: gavz/MemAnalyzer
        public void IfExeAndDumpFile_Present_Ignore_Dump()
        {
            string[] args = new string[] { "-ma", "notepad", "notepad.dmp" };
            int      pid  = DumpCreator.FindPidInProcDumpArgs(args, out string exeName);

            Assert.AreEqual("notepad", exeName);
        }
コード例 #4
0
ファイル: DumpCreatorTests.cs プロジェクト: gavz/MemAnalyzer
        public void Can_Parse_RegularexeNameSecondLast()
        {
            string[] args = new string[] { "notepad.exe", "-ma" };
            int      pid  = DumpCreator.FindPidInProcDumpArgs(args, out string exeName);

            Assert.AreEqual(0, pid);
            Assert.AreEqual("notepad.exe", exeName);
        }
コード例 #5
0
        void AllocateAndDump(string exe, int n, string dumpFile)
        {
            DumpCreator creator = new DumpCreator(true, false);

            var    process  = DumpCreatorTests.AllocStrings(exe, n);
            string dumpfile = creator.Dump(new string[] { "-ma", $"{process.Id}", $"{dumpFile}" });

            Assert.IsNotNull(dumpfile, $"Dump {dumpFile} could not be created");
            process.Kill();
        }
コード例 #6
0
ファイル: DumpCreatorTests.cs プロジェクト: gavz/MemAnalyzer
        public void Can_Dump_Process()
        {
            DumpCreator creator = new DumpCreator(true, false);
            var         process = AllocStrings();

            string file = creator.Dump(new string[] { process.Id.ToString(), "test.dmp" });

            Assert.IsNotNull(file, "Output dump file was null!");
            Assert.IsTrue(File.Exists(file), "Dump file does not exist!");
            Assert.IsNotNull(TargetInformation.GetExistingVMMapFile(file), "Associated VMMap dump file was not found. Is VMMap.exe in path?");
        }
コード例 #7
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldChooseToDumpDefaultDatabaseIfNeitherDumpNorDatabaseIsGiven() throws java.io.IOException, org.neo4j.commandline.admin.CommandFailed, org.neo4j.commandline.admin.IncorrectUsage
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldChooseToDumpDefaultDatabaseIfNeitherDumpNorDatabaseIsGiven()
        {
            // given
            DumpCreator        dumpCreator = mock(typeof(DumpCreator));
            Copier             copier      = mock(typeof(Copier));
            PushToCloudCommand command     = command().dumpCreator(dumpCreator).Copier(copier).build();

            // when
            command.Execute(array(Arg(ARG_BOLT_URI, SOME_EXAMPLE_BOLT_URI)));

            // then
            string defaultDatabase = (new Database()).defaultValue();

            verify(dumpCreator).dumpDatabase(eq(defaultDatabase), any());
            verify(copier).copy(anyBoolean(), any(), any(), any());
        }
コード例 #8
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldAcceptDatabaseNameAsSource() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldAcceptDatabaseNameAsSource()
        {
            // given
            Copier             targetCommunicator = MockedTargetCommunicator();
            DumpCreator        dumpCreator        = mock(typeof(DumpCreator));
            PushToCloudCommand command            = command().copier(targetCommunicator).DumpCreator(dumpCreator).build();

            // when
            string databaseName = "neo4j";

            command.Execute(array(Arg(ARG_DATABASE, databaseName), Arg(ARG_BOLT_URI, SOME_EXAMPLE_BOLT_URI)));

            // then
            verify(dumpCreator).dumpDatabase(eq(databaseName), any());
            verify(targetCommunicator).copy(anyBoolean(), any(), any(), any());
        }
コード例 #9
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldAuthenticateBeforeDumping() throws org.neo4j.commandline.admin.CommandFailed, java.io.IOException, org.neo4j.commandline.admin.IncorrectUsage
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldAuthenticateBeforeDumping()
        {
            // given
            Copier             copier  = MockedTargetCommunicator();
            DumpCreator        dumper  = mock(typeof(DumpCreator));
            PushToCloudCommand command = command().copier(copier).DumpCreator(dumper).build();

            // when
            command.Execute(array(Arg(ARG_BOLT_URI, "bolt+routing://mydbid.databases.neo4j.io")));

            // then
            InOrder inOrder = inOrder(copier, dumper);

            inOrder.verify(copier).authenticate(anyBoolean(), anyString(), anyString(), any(), anyBoolean());
            inOrder.verify(dumper).dumpDatabase(anyString(), any());
            inOrder.verify(copier).copy(anyBoolean(), anyString(), any(), anyString());
        }
コード例 #10
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldAcceptDatabaseNameAsSourceUsingGivenDumpTarget() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldAcceptDatabaseNameAsSourceUsingGivenDumpTarget()
        {
            // given
            Copier             targetCommunicator = MockedTargetCommunicator();
            DumpCreator        dumpCreator        = mock(typeof(DumpCreator));
            PushToCloudCommand command            = command().copier(targetCommunicator).DumpCreator(dumpCreator).build();

            // when
            string databaseName = "neo4j";
            Path   dumpFile     = Directory.file("some-dump-file").toPath();

            command.Execute(array(Arg(ARG_DATABASE, databaseName), Arg(ARG_DUMP_TO, dumpFile.ToString()), Arg(ARG_BOLT_URI, SOME_EXAMPLE_BOLT_URI)));

            // then
            verify(dumpCreator).dumpDatabase(databaseName, dumpFile);
            verify(targetCommunicator).copy(anyBoolean(), any(), any(), any());
        }
コード例 #11
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldFailOnDatabaseNameAsSourceUsingExistingDumpTarget() throws java.io.IOException, org.neo4j.commandline.admin.IncorrectUsage, org.neo4j.commandline.admin.CommandFailed
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldFailOnDatabaseNameAsSourceUsingExistingDumpTarget()
        {
            // given
            Copier             targetCommunicator = MockedTargetCommunicator();
            DumpCreator        dumpCreator        = mock(typeof(DumpCreator));
            PushToCloudCommand command            = command().copier(targetCommunicator).DumpCreator(dumpCreator).build();

            // when
            string databaseName = "neo4j";
            Path   dumpFile     = Directory.file("some-dump-file").toPath();

            Files.write(dumpFile, "some data".GetBytes());
            try
            {
                command.Execute(array(Arg(ARG_DATABASE, databaseName), Arg(ARG_DUMP_TO, dumpFile.ToString()), Arg(ARG_BOLT_URI, SOME_EXAMPLE_BOLT_URI)));
                fail("Should have failed");
            }
            catch (CommandFailed commandFailed)
            {
                // then
                assertThat(commandFailed.Message, containsString("already exists"));
            }
        }
コード例 #12
0
 internal virtual Builder DumpCreator(DumpCreator dumpCreator)
 {
     this.DumpCreatorConflict = dumpCreator;
     return(this);
 }