Search in sources :

Example 31 with UnsupportedTerminal

use of jline.UnsupportedTerminal in project GeoGig by boundlessgeo.

the class PGDescribeTest method setUp.

@Before
public void setUp() throws Exception {
    ConsoleReader consoleReader = new ConsoleReader(System.in, System.out, new UnsupportedTerminal());
    cli = new GeogigCLI(consoleReader);
    setUpGeogig(cli);
}
Also used : GeogigCLI(org.locationtech.geogig.cli.GeogigCLI) ConsoleReader(jline.console.ConsoleReader) UnsupportedTerminal(jline.UnsupportedTerminal) Before(org.junit.Before)

Example 32 with UnsupportedTerminal

use of jline.UnsupportedTerminal in project GeoGig by boundlessgeo.

the class PGImportTest method testImportException.

@Test
public void testImportException() throws Exception {
    ConsoleReader consoleReader = new ConsoleReader(System.in, System.out, new UnsupportedTerminal());
    GeogigCLI mockCli = spy(new GeogigCLI(consoleReader));
    setUpGeogig(mockCli);
    when(mockCli.getConsole()).thenThrow(new MockitoException("Exception"));
    PGImport importCommand = new PGImport();
    importCommand.all = true;
    importCommand.dataStoreFactory = TestHelper.createTestFactory();
    exception.expect(MockitoException.class);
    importCommand.run(mockCli);
}
Also used : GeogigCLI(org.locationtech.geogig.cli.GeogigCLI) ConsoleReader(jline.console.ConsoleReader) UnsupportedTerminal(jline.UnsupportedTerminal) MockitoException(org.mockito.exceptions.base.MockitoException) Test(org.junit.Test)

Example 33 with UnsupportedTerminal

use of jline.UnsupportedTerminal in project GeoGig by boundlessgeo.

the class GeoJsonImportTest method testImportException.

@Test
public void testImportException() throws Exception {
    ConsoleReader consoleReader = new ConsoleReader(System.in, System.out, new UnsupportedTerminal());
    GeogigCLI mockCli = spy(new GeogigCLI(consoleReader));
    setUpGeogig(mockCli);
    when(mockCli.getConsole()).thenThrow(new MockitoException("Exception"));
    GeoJsonImport importCommand = new GeoJsonImport();
    importCommand.geoJSONList = new ArrayList<String>();
    importCommand.geoJSONList.add(ShpImport.class.getResource("sample.geojson").getFile());
    exception.expect(MockitoException.class);
    importCommand.run(mockCli);
}
Also used : GeogigCLI(org.locationtech.geogig.cli.GeogigCLI) ConsoleReader(jline.console.ConsoleReader) UnsupportedTerminal(jline.UnsupportedTerminal) MockitoException(org.mockito.exceptions.base.MockitoException) Test(org.junit.Test)

Example 34 with UnsupportedTerminal

use of jline.UnsupportedTerminal in project GeoGig by boundlessgeo.

the class SQLServerDescribeTest method setUp.

@Before
public void setUp() throws Exception {
    ConsoleReader consoleReader = new ConsoleReader(System.in, System.out, new UnsupportedTerminal());
    cli = new GeogigCLI(consoleReader);
    setUpGeogig(cli);
}
Also used : GeogigCLI(org.locationtech.geogig.cli.GeogigCLI) ConsoleReader(jline.console.ConsoleReader) UnsupportedTerminal(jline.UnsupportedTerminal) Before(org.junit.Before)

Example 35 with UnsupportedTerminal

use of jline.UnsupportedTerminal in project GeoGig by boundlessgeo.

the class SQLServerDescribeTest method testFlushException.

@Test
public void testFlushException() throws Exception {
    ConsoleReader consoleReader = spy(new ConsoleReader(System.in, System.out, new UnsupportedTerminal()));
    GeogigCLI testCli = new GeogigCLI(consoleReader);
    setUpGeogig(testCli);
    doThrow(new IOException("Exception")).when(consoleReader).flush();
    SQLServerDescribe describeCommand = new SQLServerDescribe();
    describeCommand.table = "table1";
    describeCommand.dataStoreFactory = TestHelper.createTestFactory();
    exception.expect(Exception.class);
    describeCommand.run(testCli);
}
Also used : GeogigCLI(org.locationtech.geogig.cli.GeogigCLI) ConsoleReader(jline.console.ConsoleReader) UnsupportedTerminal(jline.UnsupportedTerminal) IOException(java.io.IOException) Test(org.junit.Test)

Aggregations

UnsupportedTerminal (jline.UnsupportedTerminal)43 ConsoleReader (jline.console.ConsoleReader)43 GeogigCLI (org.locationtech.geogig.cli.GeogigCLI)42 Before (org.junit.Before)19 Test (org.junit.Test)15 MockitoException (org.mockito.exceptions.base.MockitoException)12 TestPlatform (org.locationtech.geogig.api.TestPlatform)8 File (java.io.File)7 CLITestContextBuilder (org.locationtech.geogig.cli.test.functional.general.CLITestContextBuilder)7 CommitOp (org.locationtech.geogig.api.porcelain.CommitOp)6 IOException (java.io.IOException)5 ByteArrayInputStream (java.io.ByteArrayInputStream)2 Platform (org.locationtech.geogig.api.Platform)2 FileBackedOutputStream (com.google.common.io.FileBackedOutputStream)1 JsonObject (com.google.gson.JsonObject)1 BufferedOutputStream (java.io.BufferedOutputStream)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 InputStream (java.io.InputStream)1 Connection (java.sql.Connection)1 SQLException (java.sql.SQLException)1