Skip to content

Commit

Permalink
Clean up.
Browse files Browse the repository at this point in the history
  • Loading branch information
srbaker committed Oct 26, 2016
1 parent 477c0dc commit 6326953
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 19 deletions.
Expand Up @@ -20,8 +20,8 @@
package org.neo4j.commandline.admin; package org.neo4j.commandline.admin;


import java.nio.file.Path; import java.nio.file.Path;
import java.util.List;
import java.util.Optional; import java.util.Optional;
import java.util.Set;


import org.neo4j.helpers.Service; import org.neo4j.helpers.Service;
import org.neo4j.helpers.collection.Iterables; import org.neo4j.helpers.collection.Iterables;
Expand Down Expand Up @@ -95,7 +95,7 @@ protected Blocker( String key, String... altKeys )
/** /**
* @return a list of the commands this blocker applies to. * @return a list of the commands this blocker applies to.
*/ */
public abstract List<String> commands(); public abstract Set<String> commands();


/** /**
* @return explanation of why a command was blocked. This will be shown to the user. * @return explanation of why a command was blocked. This will be shown to the user.
Expand Down
Expand Up @@ -33,8 +33,7 @@
import java.nio.file.NoSuchFileException; import java.nio.file.NoSuchFileException;
import java.nio.file.Path; import java.nio.file.Path;
import java.nio.file.Paths; import java.nio.file.Paths;
import java.util.ArrayList; import java.util.Arrays;
import java.util.List;
import java.util.function.Predicate; import java.util.function.Predicate;


import org.neo4j.commandline.admin.AdminCommand; import org.neo4j.commandline.admin.AdminCommand;
Expand All @@ -43,7 +42,6 @@
import org.neo4j.commandline.admin.IncorrectUsage; import org.neo4j.commandline.admin.IncorrectUsage;
import org.neo4j.dbms.archive.Dumper; import org.neo4j.dbms.archive.Dumper;
import org.neo4j.io.fs.DefaultFileSystemAbstraction; import org.neo4j.io.fs.DefaultFileSystemAbstraction;
import org.neo4j.kernel.configuration.Config;
import org.neo4j.kernel.internal.StoreLocker; import org.neo4j.kernel.internal.StoreLocker;
import org.neo4j.test.rule.TestDirectory; import org.neo4j.test.rule.TestDirectory;


Expand Down Expand Up @@ -324,13 +322,8 @@ public void shouldBlockDumpIfABlockerSaysSo() throws IncorrectUsage
when( blocker.doesBlock( any(), any() ) ).thenReturn( true ); when( blocker.doesBlock( any(), any() ) ).thenReturn( true );
when( blocker.explanation() ).thenReturn( "blocked" ); when( blocker.explanation() ).thenReturn( "blocked" );


List<AdminCommand.Blocker> blockers = new ArrayList<AdminCommand.Blocker>()
{{
add( blocker );
}};

BlockerLocator blockerLocator = mock( BlockerLocator.class ); BlockerLocator blockerLocator = mock( BlockerLocator.class );
when(blockerLocator.findBlockersForCommand( "dump" )).thenReturn( blockers ); when( blockerLocator.findBlockersForCommand( "dump" ) ).thenReturn( Arrays.asList( blocker ) );


try try
{ {
Expand All @@ -355,15 +348,9 @@ public void shouldBlockDumpIfOneBlockerOutOfManySaysSo() throws IncorrectUsage
when( falseBlocker.doesBlock( any(), any() ) ).thenReturn( false ); when( falseBlocker.doesBlock( any(), any() ) ).thenReturn( false );
when( falseBlocker.explanation() ).thenReturn( "falseBlocker explanation" ); when( falseBlocker.explanation() ).thenReturn( "falseBlocker explanation" );


List<AdminCommand.Blocker> blockers = new ArrayList<AdminCommand.Blocker>()
{{
add( trueBlocker );
add( falseBlocker );
add( falseBlocker );
}};

BlockerLocator blockerLocator = mock( BlockerLocator.class ); BlockerLocator blockerLocator = mock( BlockerLocator.class );
when(blockerLocator.findBlockersForCommand( "dump" )).thenReturn( blockers ); when( blockerLocator.findBlockersForCommand( "dump" ) ).thenReturn(
Arrays.asList( trueBlocker, falseBlocker, falseBlocker ) );


try try
{ {
Expand Down

0 comments on commit 6326953

Please sign in to comment.