Beispiel #1
0
 public AdminTool(CommandLocator commandLocator, BlockerLocator blockerLocator, OutsideWorld outsideWorld, bool debug)
 {
     this._commandLocator = CommandLocator.withAdditionalCommand(Help(), commandLocator);
     this._blockerLocator = blockerLocator;
     this._outsideWorld   = outsideWorld;
     this._debug          = debug;
     this._usage          = new Usage(SCRIPT_NAME, this._commandLocator);
 }
Beispiel #2
0
//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 graphDir = new File(GraphDatabaseSettings.DEFAULT_DATABASE_NAME);

            _confDir = new File(graphDir, "conf");
            _homeDir = new File(graphDir, "home");
            @out     = mock(typeof(OutsideWorld));
            ResetOutsideWorldMock();
            _tool = new AdminTool(CommandLocator.fromServiceLocator(), BlockerLocator.fromServiceLocator(), @out, true);
        }
Beispiel #3
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public static void main(String[] args) throws java.io.IOException
        public static void Main(string[] args)
        {
            Path homeDir   = Paths.get(Neo4jHome);
            Path configDir = Paths.get(Neo4jConf);
            bool debug     = !string.ReferenceEquals(Neo4jDebug, null);

            using (RealOutsideWorld outsideWorld = new RealOutsideWorld())
            {
                (new AdminTool(CommandLocator.fromServiceLocator(), BlockerLocator.fromServiceLocator(), outsideWorld, debug)).Execute(homeDir, configDir, args);
            }
        }
Beispiel #4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void shouldNotBlockIfNoneOfTheBlockersBlock() throws CommandFailed, IncorrectUsage
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        internal virtual void ShouldNotBlockIfNoneOfTheBlockersBlock()
        {
            AdminCommand command = mock(typeof(AdminCommand));

            AdminCommand_Blocker falseBlocker = mock(typeof(AdminCommand_Blocker));

            when(falseBlocker.DoesBlock(any(), any())).thenReturn(false);
            when(falseBlocker.Explanation()).thenReturn("falseBlocker explanation");

            BlockerLocator blockerLocator = mock(typeof(BlockerLocator));

            when(blockerLocator.FindBlockers("command")).thenReturn(Arrays.asList(falseBlocker, falseBlocker, falseBlocker));

            (new AdminTool(CannedCommand("command", command), blockerLocator, new NullOutsideWorld(), false)).execute(null, null, "command", "the", "other", "args");
            verify(command).execute(new string[] { "the", "other", "args" });
        }
Beispiel #5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void shouldBlockDumpIfABlockerSaysSo()
        internal virtual void ShouldBlockDumpIfABlockerSaysSo()
        {
            OutsideWorld outsideWorld = mock(typeof(OutsideWorld));
            AdminCommand command      = mock(typeof(AdminCommand));

            AdminCommand_Blocker blocker = mock(typeof(AdminCommand_Blocker));

            when(blocker.DoesBlock(any(), any())).thenReturn(true);
            when(blocker.Commands()).thenReturn(Collections.singleton("command"));
            when(blocker.Explanation()).thenReturn("the explanation");

            BlockerLocator blockerLocator = mock(typeof(BlockerLocator));

            when(blockerLocator.FindBlockers("command")).thenReturn(Collections.singletonList(blocker));

            (new AdminTool(CannedCommand("command", command), blockerLocator, outsideWorld, false)).execute(null, null, "command");

            verify(outsideWorld).stdErrLine("command failed: the explanation");
            verify(outsideWorld).exit(STATUS_ERROR);
        }
Beispiel #6
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void shouldBlockDumpIfOneBlockerOutOfManySaysSo()
        internal virtual void ShouldBlockDumpIfOneBlockerOutOfManySaysSo()
        {
            OutsideWorld outsideWorld = mock(typeof(OutsideWorld));
            AdminCommand command      = mock(typeof(AdminCommand));

            AdminCommand_Blocker trueBlocker = mock(typeof(AdminCommand_Blocker));

            when(trueBlocker.DoesBlock(any(), any())).thenReturn(true);
            when(trueBlocker.Explanation()).thenReturn("trueBlocker explanation");

            AdminCommand_Blocker falseBlocker = mock(typeof(AdminCommand_Blocker));

            when(falseBlocker.DoesBlock(any(), any())).thenReturn(false);
            when(falseBlocker.Explanation()).thenReturn("falseBlocker explanation");

            BlockerLocator blockerLocator = mock(typeof(BlockerLocator));

            when(blockerLocator.FindBlockers("command")).thenReturn(Arrays.asList(falseBlocker, trueBlocker, falseBlocker));

            (new AdminTool(CannedCommand("command", command), blockerLocator, outsideWorld, false)).execute(null, null, "command");

            verify(outsideWorld).stdErrLine("command failed: trueBlocker explanation");
            verify(outsideWorld).exit(STATUS_ERROR);
        }