db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bryan Pendleton (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (DERBY-5327) Convert tools/ij5.sql to junit
Date Wed, 13 Jul 2011 02:22:59 GMT

    [ https://issues.apache.org/jira/browse/DERBY-5327?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13064291#comment-13064291

Bryan Pendleton commented on DERBY-5327:

I think that these problems arise from the fact that ScriptTestCase.runTest calls
ij.runScript, which in turn calls utilMain.goScript, and these are not the "normal"
ij invocation methods, but rather are slightly special and don't do quite the
same things.

In particular:

Question 1: 
  Since ij.runScript calls utilMain.goScript, rather than utilMain.go, we don't
ever process the ij.showNoConnectionsAtStart logic, because the code to
show the connections at start is in utilMain.go, and isn't being executed.

Question 2: 
  Similar to (1), ij.showNoCountForSelect is handled by utilMain.go, and so
it isn't being executed, either.

Question 3:
  ScriptTestCase passes a newly-created connection through to utilMain.goScript,
and it gets set to be the current connection, which does indeed affect the
expected result. I had some limited success with fixing this by making the
following change to utilMain.goScript; the idea is that if there is already a current
session when goScript() is called, it should preserve that current session
instead of using the connection passed to it from the caller.

Index: utilMain.java
--- utilMain.java	(revision 1145422)
+++ utilMain.java	(working copy)
@@ -273,7 +273,10 @@
 			LocalizedInput in)
 		JDBCDisplayUtil.showSelectCount = false;
+		Session curSess = connEnv[0].getSession();
 		connEnv[0].addSession(conn, (String) null);
+		if( curSess != null )
+			connEnv[0].setCurrentSession( curSess.name );
 		fileInput = initialFileInput = !in.isStandardInput();
 		return runScriptGuts();

I guess the bottom line here is that 'ij5.sql' is testing certain
features of utilMain.go(), and therefore it is hard to test these
through ScriptTestCase because it uses runScript/goScript
rather than go().

> Convert tools/ij5.sql  to junit
> -------------------------------
>                 Key: DERBY-5327
>                 URL: https://issues.apache.org/jira/browse/DERBY-5327
>             Project: Derby
>          Issue Type: Sub-task
>          Components: Test
>            Reporter: Houx Zhang
>            Assignee: Houx Zhang
>              Labels: gsoc2011
>         Attachments: 5327-1.patch, 5327-ij5-1.out

This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira


View raw message