Search in sources :

Example 11 with OutsideWorld

use of org.neo4j.commandline.admin.OutsideWorld in project neo4j by neo4j.

the class ImportCommandTest method defaultsToCsvWhenModeNotSpecified.

@Test
public void defaultsToCsvWhenModeNotSpecified() throws Exception {
    File homeDir = testDir.directory("home");
    ImporterFactory mockImporterFactory = mock(ImporterFactory.class);
    when(mockImporterFactory.getImporterForMode(eq("csv"), any(Args.class), any(Config.class), any(OutsideWorld.class))).thenReturn(mock(Importer.class));
    try (RealOutsideWorld outsideWorld = new RealOutsideWorld()) {
        ImportCommand importCommand = new ImportCommand(homeDir.toPath(), testDir.directory("conf").toPath(), outsideWorld, mockImporterFactory);
        String[] arguments = { "--database=foo", "--from=bar" };
        importCommand.execute(arguments);
        verify(mockImporterFactory).getImporterForMode(eq("csv"), any(Args.class), any(Config.class), any(OutsideWorld.class));
    }
}
Also used : Args(org.neo4j.helpers.Args) NullOutsideWorld(org.neo4j.commandline.admin.NullOutsideWorld) OutsideWorld(org.neo4j.commandline.admin.OutsideWorld) RealOutsideWorld(org.neo4j.commandline.admin.RealOutsideWorld) RealOutsideWorld(org.neo4j.commandline.admin.RealOutsideWorld) Config(org.neo4j.kernel.configuration.Config) Matchers.containsString(org.hamcrest.Matchers.containsString) File(java.io.File) Test(org.junit.Test)

Example 12 with OutsideWorld

use of org.neo4j.commandline.admin.OutsideWorld in project neo4j by neo4j.

the class SetDefaultAdminCommandTest method setup.

@Before
public void setup() throws IOException, InvalidArgumentsException {
    OutsideWorld mock = mock(OutsideWorld.class);
    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.getInstance(), fileSystem);
    users.create(new User.Builder("jake", Credential.forPassword("123")).withRequiredPasswordChange(false).build());
    adminIniFile = new File(CommunitySecurityModule.getUserRepositoryFile(config).getParentFile(), "admin.ini");
}
Also used : OutsideWorld(org.neo4j.commandline.admin.OutsideWorld) UserRepository(org.neo4j.server.security.auth.UserRepository) FileUserRepository(org.neo4j.server.security.auth.FileUserRepository) User(org.neo4j.kernel.impl.security.User) File(java.io.File) Before(org.junit.Before)

Example 13 with OutsideWorld

use of org.neo4j.commandline.admin.OutsideWorld in project neo4j by neo4j.

the class SetInitialPasswordCommandTest method setup.

@Before
public void setup() {
    fileSystem = fileSystemRule.get();
    OutsideWorld mock = mock(OutsideWorld.class);
    when(mock.fileSystem()).thenReturn(fileSystem);
    setPasswordCommand = new SetInitialPasswordCommand(testDir.directory("home").toPath(), testDir.directory("conf").toPath(), mock);
    authInitFile = CommunitySecurityModule.getInitialUserRepositoryFile(setPasswordCommand.loadNeo4jConfig());
    authFile = CommunitySecurityModule.getUserRepositoryFile(setPasswordCommand.loadNeo4jConfig());
}
Also used : OutsideWorld(org.neo4j.commandline.admin.OutsideWorld) Before(org.junit.Before)

Aggregations

OutsideWorld (org.neo4j.commandline.admin.OutsideWorld)13 Test (org.junit.Test)11 Path (java.nio.file.Path)10 File (java.io.File)9 CheckConsistencyConfig (org.neo4j.consistency.checking.full.CheckConsistencyConfig)9 Config (org.neo4j.kernel.configuration.Config)5 ProgressMonitorFactory (org.neo4j.helpers.progress.ProgressMonitorFactory)4 FileSystemAbstraction (org.neo4j.io.fs.FileSystemAbstraction)4 LogProvider (org.neo4j.logging.LogProvider)4 Before (org.junit.Before)2 Matchers.containsString (org.hamcrest.Matchers.containsString)1 CommandFailed (org.neo4j.commandline.admin.CommandFailed)1 NullOutsideWorld (org.neo4j.commandline.admin.NullOutsideWorld)1 RealOutsideWorld (org.neo4j.commandline.admin.RealOutsideWorld)1 Args (org.neo4j.helpers.Args)1 User (org.neo4j.kernel.impl.security.User)1 FileUserRepository (org.neo4j.server.security.auth.FileUserRepository)1 UserRepository (org.neo4j.server.security.auth.UserRepository)1