Search in sources :

Example 36 with ExecutionContext

use of org.neo4j.cli.ExecutionContext in project neo4j by neo4j.

the class CheckConsistencyCommandIT method canRunOnBackup.

@Test
void canRunOnBackup() throws Exception {
    ConsistencyCheckService consistencyCheckService = mock(ConsistencyCheckService.class);
    DatabaseLayout backupLayout = Neo4jLayout.ofFlat(testDirectory.directory("backup")).databaseLayout(DEFAULT_DATABASE_NAME);
    prepareBackupDatabase(backupLayout);
    CheckConsistencyCommand checkConsistencyCommand = new CheckConsistencyCommand(new ExecutionContext(homeDir, confPath), consistencyCheckService);
    when(consistencyCheckService.runFullConsistencyCheck(eq(backupLayout), any(Config.class), any(ProgressMonitorFactory.class), any(LogProvider.class), any(FileSystemAbstraction.class), eq(false), any(), any(ConsistencyFlags.class))).thenReturn(ConsistencyCheckService.Result.success(null, null));
    CommandLine.populateCommand(checkConsistencyCommand, "--backup=" + backupLayout.databaseDirectory());
    checkConsistencyCommand.execute();
    verify(consistencyCheckService).runFullConsistencyCheck(eq(backupLayout), any(Config.class), any(ProgressMonitorFactory.class), any(LogProvider.class), any(FileSystemAbstraction.class), eq(false), any(), any(ConsistencyFlags.class));
}
Also used : LogProvider(org.neo4j.logging.LogProvider) ExecutionContext(org.neo4j.cli.ExecutionContext) DefaultFileSystemAbstraction(org.neo4j.io.fs.DefaultFileSystemAbstraction) FileSystemAbstraction(org.neo4j.io.fs.FileSystemAbstraction) ProgressMonitorFactory(org.neo4j.internal.helpers.progress.ProgressMonitorFactory) ConsistencyFlags(org.neo4j.consistency.checking.full.ConsistencyFlags) Config(org.neo4j.configuration.Config) DatabaseLayout(org.neo4j.io.layout.DatabaseLayout) ConsistencyCheckService(org.neo4j.consistency.ConsistencyCheckService) CheckConsistencyCommand(org.neo4j.consistency.CheckConsistencyCommand) Test(org.junit.jupiter.api.Test)

Example 37 with ExecutionContext

use of org.neo4j.cli.ExecutionContext in project neo4j by neo4j.

the class PushToCloudCommandTest method setUp.

@BeforeAll
void setUp() throws IOException {
    homeDir = directory.directory("home-dir");
    Path configDir = directory.directory("config-dir");
    Path configFile = configDir.resolve("neo4j.conf");
    Files.createFile(configFile);
    PrintStream nullOutputStream = new PrintStream(NullOutputStream.nullOutputStream());
    ctx = new ExecutionContext(homeDir, configDir, nullOutputStream, nullOutputStream, directory.getFileSystem());
    createDbAndDump();
}
Also used : Path(java.nio.file.Path) PrintStream(java.io.PrintStream) ExecutionContext(org.neo4j.cli.ExecutionContext) BeforeAll(org.junit.jupiter.api.BeforeAll)

Example 38 with ExecutionContext

use of org.neo4j.cli.ExecutionContext in project neo4j by neo4j.

the class HttpCopierTest method setup.

@BeforeEach
public void setup() {
    wireMock = new WireMockServer(TEST_PORT);
    wireMock.start();
    Path dir = directory.homePath();
    PrintStream out = new PrintStream(NULL_OUTPUT_STREAM);
    ctx = new ExecutionContext(dir, dir, out, out, fs);
}
Also used : Path(java.nio.file.Path) WireMock.matchingJsonPath(com.github.tomakehurst.wiremock.client.WireMock.matchingJsonPath) PrintStream(java.io.PrintStream) ExecutionContext(org.neo4j.cli.ExecutionContext) WireMockServer(com.github.tomakehurst.wiremock.WireMockServer) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

ExecutionContext (org.neo4j.cli.ExecutionContext)38 Test (org.junit.jupiter.api.Test)30 PrintStream (java.io.PrintStream)21 CheckConsistencyCommand (org.neo4j.consistency.CheckConsistencyCommand)13 Path (java.nio.file.Path)12 ConsistencyCheckService (org.neo4j.consistency.ConsistencyCheckService)12 ByteArrayOutputStream (java.io.ByteArrayOutputStream)10 ConsistencyFlags (org.neo4j.consistency.checking.full.ConsistencyFlags)10 Config (org.neo4j.configuration.Config)8 DatabaseLayout (org.neo4j.io.layout.DatabaseLayout)8 DefaultFileSystemAbstraction (org.neo4j.io.fs.DefaultFileSystemAbstraction)6 FileSystemAbstraction (org.neo4j.io.fs.FileSystemAbstraction)6 ProgressMonitorFactory (org.neo4j.internal.helpers.progress.ProgressMonitorFactory)5 LogProvider (org.neo4j.logging.LogProvider)5 BeforeEach (org.junit.jupiter.api.BeforeEach)4 CommandFailedException (org.neo4j.cli.CommandFailedException)4 MemoryRecommendationsCommand.bytesToString (org.neo4j.commandline.dbms.MemoryRecommendationsCommand.bytesToString)4 FileSystem (java.nio.file.FileSystem)2 WireMockServer (com.github.tomakehurst.wiremock.WireMockServer)1 WireMock.matchingJsonPath (com.github.tomakehurst.wiremock.client.WireMock.matchingJsonPath)1