Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide output for SqlLineArgsTest tests #134

Closed
arina-ielchiieva opened this issue Sep 8, 2018 · 5 comments
Closed

Hide output for SqlLineArgsTest tests #134

arina-ielchiieva opened this issue Sep 8, 2018 · 5 comments

Comments

@arina-ielchiieva
Copy link
Collaborator

Running sqlline.SqlLineArgsTest
sqlline> java.lang.IllegalArgumentException: No current connection
	at sqlline.SqlLine.getConnection(SqlLine.java:245)
	at sqlline.Commands.nativesql(Commands.java:358)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at sqlline.ReflectiveCommandHandler.execute(ReflectiveCommandHandler.java:38)
	at sqlline.SqlLine.dispatch(SqlLine.java:627)
	at sqlline.SqlLine.runCommands(SqlLine.java:1666)
	at sqlline.SqlLineArgsTest.testNPE(SqlLineArgsTest.java:772)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
	at mockit.integration.junit4.internal.JUnit4TestRunnerDecorator.executeTestMethod(JUnit4TestRunnerDecorator.java:162)
	at mockit.integration.junit4.internal.JUnit4TestRunnerDecorator.invokeExplosively(JUnit4TestRunnerDecorator.java:71)
	at mockit.integration.junit4.internal.MockFrameworkMethod.invokeExplosively(MockFrameworkMethod.java:37)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:264)
	at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:153)
	at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:124)
	at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:200)
	at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153)
	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)
sqlline> sqlline> sqlline> sqlline> sqlline> sqlline> sqlline> [ Hit "enter" for more ("q" to exit) ][ Hit "enter" for more ("q" to exit) ][ Hit "enter" for more ("q" to exit) ][ Hit "enter" for more ("q" to exit) ][ Hit "enter" for more ("q" to exit) ][ Hit "enter" for more ("q" to exit) ][ Hit "enter" for more ("q" to exit) ][ Hit "enter" for more ("q" to exit) ][ Hit "enter" for more ("q" to exit) ][ Hit "enter" for more ("q" to exit) ][ Hit "enter" for more ("q" to exit) ][ Hit "enter" for more ("q" to exit) ][ Hit "enter" for more ("q" to exit) ][ Hit "enter" for more ("q" to exit) ][ Hit "enter" for more ("q" to exit) ][ Hit "enter" for more ("q" to exit) ][ Hit "enter" for more ("q" to exit) ][ Hit "enter" for more ("q" to exit) ][ Hit "enter" for more ("q" to exit) ][ Hit "enter" for more ("q" to exit) ][ Hit "enter" for more ("q" to exit) ][ Hit "enter" for more ("q" to exit) ][ Hit "enter" for more ("q" to exit) ][ Hit "enter" for more ("q" to exit) ][ Hit "enter" for more ("q" to exit) ][ Hit "enter" for more ("q" to exit) ][ Hit "enter" for more ("q" to exit) ][ Hit "enter" for more ("q" to exit) ][ Hit "enter" for more ("q" to exit) ][ Hit "enter" for more ("q" to exit) ][ Hit "enter" for more ("q" to exit) ][ Hit "enter" for more ("q" to exit) ][ Hit "enter" for more ("q" to exit) ][ Hit "enter" for more ("q" to exit) ][ Hit "enter" for more ("q" to exit) ]java.io.FileNotFoundException: /tmp/sqllinenegative7622403019144965972temp (No such file or directory)
	at java.io.FileInputStream.open0(Native Method)
	at java.io.FileInputStream.open(FileInputStream.java:195)
	at java.io.FileInputStream.<init>(FileInputStream.java:138)
	at java.io.FileInputStream.<init>(FileInputStream.java:93)
	at java.io.FileReader.<init>(FileReader.java:58)
	at sqlline.Commands.run(Commands.java:1344)
	at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at sqlline.ReflectiveCommandHandler.execute(ReflectiveCommandHandler.java:38)
	at sqlline.SqlLine.dispatch(SqlLine.java:627)
	at sqlline.SqlLine.initArgs(SqlLine.java:424)
	at sqlline.SqlLine.begin(SqlLine.java:479)
	at sqlline.SqlLineArgsTest.run(SqlLineArgsTest.java:84)
	at sqlline.SqlLineArgsTest.runScript(SqlLineArgsTest.java:111)
	at sqlline.SqlLineArgsTest.runScript(SqlLineArgsTest.java:90)
	at sqlline.SqlLineArgsTest.testNegativeScriptFile(SqlLineArgsTest.java:690)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
	at mockit.integration.junit4.internal.JUnit4TestRunnerDecorator.executeTestMethod(JUnit4TestRunnerDecorator.java:162)
	at mockit.integration.junit4.internal.JUnit4TestRunnerDecorator.invokeExplosively(JUnit4TestRunnerDecorator.java:71)
	at mockit.integration.junit4.internal.MockFrameworkMethod.invokeExplosively(MockFrameworkMethod.java:37)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:264)
	at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:153)
	at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:124)
	at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:200)
	at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153)
	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)
java.lang.IllegalArgumentException: No current connection
	at sqlline.SqlLine.getConnection(SqlLine.java:245)
	at sqlline.Commands.tables(Commands.java:337)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at sqlline.ReflectiveCommandHandler.execute(ReflectiveCommandHandler.java:38)
	at sqlline.SqlLine.dispatch(SqlLine.java:627)
	at sqlline.SqlLine.runCommands(SqlLine.java:1666)
	at sqlline.Commands.run(Commands.java:1393)
	at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at sqlline.ReflectiveCommandHandler.execute(ReflectiveCommandHandler.java:38)
	at sqlline.SqlLine.dispatch(SqlLine.java:627)
	at sqlline.SqlLine.initArgs(SqlLine.java:424)
	at sqlline.SqlLine.begin(SqlLine.java:479)
	at sqlline.SqlLineArgsTest.run(SqlLineArgsTest.java:84)
	at sqlline.SqlLineArgsTest.runScript(SqlLineArgsTest.java:111)
	at sqlline.SqlLineArgsTest.runScript(SqlLineArgsTest.java:90)
	at sqlline.SqlLineArgsTest.checkScriptFile(SqlLineArgsTest.java:134)
	at sqlline.SqlLineArgsTest.testH2TablesWithErrorUrl(SqlLineArgsTest.java:1234)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
	at mockit.integration.junit4.internal.JUnit4TestRunnerDecorator.executeTestMethod(JUnit4TestRunnerDecorator.java:162)
	at mockit.integration.junit4.internal.JUnit4TestRunnerDecorator.invokeExplosively(JUnit4TestRunnerDecorator.java:71)
	at mockit.integration.junit4.internal.MockFrameworkMethod.invokeExplosively(MockFrameworkMethod.java:37)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:264)
	at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:153)
	at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:124)
	at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:200)
	at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153)
	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)
Tests run: 58, Failures: 0, Errors: 0, Skipped: 1, Time elapsed: 4.52 sec - in sqlline.SqlLineArgsTest
@arina-ielchiieva
Copy link
Collaborator Author

arina-ielchiieva commented Sep 8, 2018

Exceptions are not that annoying compared to lengthy output line:

sqlline> sqlline> sqlline> sqlline> sqlline> sqlline> sqlline> [ Hit "enter" for more ("q" to exit) ][ Hit "enter" for more ("q" to exit) ][ Hit "enter" for more ("q" to exit) ][ Hit "enter" for more ("q" to exit) ][ Hit "enter" for more ("q" to exit) ][ Hit "enter" for more ("q" to exit) ][ Hit "enter" for more ("q" to exit) ][ Hit "enter" for more ("q" to exit) ][ Hit "enter" for more ("q" to exit) ][ Hit "enter" for more ("q" to exit) ][ Hit "enter" for more ("q" to exit) ][ Hit "enter" for more ("q" to exit) ][ Hit "enter" for more ("q" to exit) ][ Hit "enter" for more ("q" to exit) ][ Hit "enter" for more ("q" to exit) ][ Hit "enter" for more ("q" to exit) ][ Hit "enter" for more ("q" to exit) ][ Hit "enter" for more ("q" to exit) ][ Hit "enter" for more ("q" to exit) ][ Hit "enter" for more ("q" to exit) ][ Hit "enter" for more ("q" to exit) ][ Hit "enter" for more ("q" to exit) ][ Hit "enter" for more ("q" to exit) ][ Hit "enter" for more ("q" to exit) ][ Hit "enter" for more ("q" to exit) ][ Hit "enter" for more ("q" to exit) ][ Hit "enter" for more ("q" to exit) ][ Hit "enter" for more ("q" to exit) ][ Hit "enter" for more ("q" to exit) ][ Hit "enter" for more ("q" to exit) ][ Hit "enter" for more ("q" to exit) ][ Hit "enter" for more ("q" to exit) ][ Hit "enter" for more ("q" to exit) ][ Hit "enter" for more ("q" to exit) ][ Hit "enter" for more ("q" to exit) ]java.io.FileNotFoundException: /tmp/sqllinenegative7622403019144965972temp (No such file or directory)

@snuyanzin
Copy link
Collaborator

snuyanzin commented Sep 9, 2018

sqlline> sqlline> sqlline> sqlline> sqlline> sqlline> sqlline> [ Hit "enter" for more ("q" to exit) ][ Hit "enter"

this happens while !manual test and will be fixed together with moving to jline3 (at least for linux) as jline3's less will be used instead of silly pager

@arina-ielchiieva
Copy link
Collaborator Author

Tests that use checkScriptFile do not produce output.
Tests that use run or

    SqlLine sqlLine = new SqlLine();

    ByteArrayOutputStream os = new ByteArrayOutputStream();
    PrintStream sqllineOutputStream = new PrintStream(os);
    sqlLine.setOutputStream(sqllineOutputStream);
    sqlLine.setErrorStream(sqllineOutputStream);
    final InputStream is = new ByteArrayInputStream(new byte[0]);
    SqlLine.Status status = sqlLine.begin(new String[]{}, is, false);

do produce sqlline>.

@julianhyde
Copy link
Owner

Partial fix in 4689fa7.

@julianhyde
Copy link
Owner

Fixed in f9aa69e, PR #234.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants