If in an earlier test, the sproc returns a variable which you store in ${ReqId}, then you should be able to use the value of ReqId in a later test.
You can also set the value of ReqId using the set element, which sets it to an initial value. Can you provide more details, such as the test element of the test which generates the ${ReqId} variable and the test element for the test which uses it?
BTW, as mentioned in my previous mail, please post to the forum, that way your problem gets more visibility.
Thanks
Sujit
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
If I run these 2 tests it is giving me an error like the following
*** expected:
[sqlunit] <result />
[sqlunit] *** but got:
[sqlunit] <result>
[sqlunit] <exception>
[sqlunit] <code>249</code>
[sqlunit] <message>Syntax error during explicit conversion of VARCHAR value '${ReqIdV}' to a NUMERIC field.</message>
I think is not taking value of a variable ${ReqIdV}.But it is considering ${ReqIdV} as string.
So please tell how to solve this problem.
and oner more thing ,In the 1st test case I am inserting some value to NUMERIC i.e 0 and to TIMESTAMP field.
But actually I don't want to insert anything to those fields in the database.So how to do that.I can't leave those fields as blank in this test case
Advanced thanks
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
> and oner more thing ,In the 1st test case I am
> inserting some value to NUMERIC i.e 0 and to TIMESTAMP field.
> But actually I don't want to insert anything to those
> fields in the database.So how to do that.I can't leave
> those fields as blank in this test case
Not sure about what you are asking, but Sybase has a method of supplying default arguments (similar to C++) in its argument list, so if you were to say that @numvar integer=0 inside your argument list, then you would not have to declare it in the call, it would be automatically defaulted to 0.
Or are you asking how to set a input argument to null? Didn't think of that, but we could have the string [Nn][Uu][Ll][Ll] indicate a null value for input params. However, that puts a kink for tests that need to use a string "NULL". Suggestions?
-sujit
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Looked at the code, and the functionality already exists. If you specify the element text of the <param> element as NULL, then it will be considered a NULL. Release 2.1 will also have a new <param> attribute is-null which has the same behavior. Of course this means that input params which are string "NULL" will not work, but I dont want to take this out because of backward compatibility issues.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi All, I am new to SQLUNIT and trying to test a simple stored proc. In doing so I am getting a classCastException().
the userId is "super" and the password I am expecting is "super"
Any help will be greatly appreciated
thanks,
kwadwo
-----------------------------------
Below is the stored proc
-----------------------------------
procedure getPasswordSP(
in_users_sys_id in change_on_setup.users_sysinfo.users_sys_id%TYPE,
out_password in out change_on_setup.users_sysinfo.users_sys_password%TYPE);
----------------------------------------
Here is my xml:
--------------------------------------------------
<?xml version="1.0"?>
<!DOCTYPE sqlunit SYSTEM "file:src/com/sf/dtd/sqlunit.dtd">
<sqlunit>
<connection>
<driver>oracle.jdbc.driver.OracleDriver</driver>
-------------------------------------------
Below is the Output I am getting
-------------------------------------------
sqlunit-test:
[sqlunit] WARN [main] (SQLUnit.java:158) - log4j.properties not found (using
defaults)
[sqlunit] WE are in the TEST WRAPPER
[sqlunit] DEBUG [main] (SQLUnit.java:217) - >> testWrapper()
[sqlunit] DEBUG [main] (SQLUnit.java:239) - >> processDoc()
[sqlunit] DEBUG [main] (TypeMapper.java:67) - instantiating TypeMapper
[sqlunit] DEBUG [main] (TypeMapper.java:189) - loading types from: net.sourcef
orge.sqlunit.types
[sqlunit] DEBUG [main] (TypeMapper.java:189) - loading types from: usertypes
[sqlunit] DEBUG [main] (TypeMapper.java:221) - loading non-mapped types
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: -7
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: -7
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: BIT
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: -6
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: -6
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: TINYINT
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: 5
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: 5
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: SMALLINT
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: 4
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: 4
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: INTEGER
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: -5
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: -5
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: BIGINT
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: 6
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: 6
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: FLOAT
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: 7
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: 7
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: REAL
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: 8
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: 8
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: DOUBLE
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: 2
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: 2
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: NUMERIC
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: 3
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: 3
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: DECIMAL
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: 1
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: 1
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: CHAR
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: 12
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: 12
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: VARCHAR
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: -1
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: -1
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: LONGVARCH
AR
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: 91
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: 91
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: DATE
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: 92
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: 92
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: TIME
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: 93
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: 93
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: TIMESTAMP
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: -2
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: -2
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: BINARY
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: -3
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: -3
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: VARBINARY
[sqlunit] at net.sourceforge.sqlunit.SQLUnit.runTest(SQLUnit.java:195)
[sqlunit] at net.sourceforge.sqlunit.ant.SqlunitTask.execute(SqlunitTask.j
ava:110)
[sqlunit] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.ja
va:269)
[sqlunit] at org.apache.tools.ant.Task.perform(Task.java:364)
[sqlunit] at org.apache.tools.ant.Target.execute(Target.java:301)
[sqlunit] at org.apache.tools.ant.Target.performTasks(Target.java:328)
[sqlunit] at org.apache.tools.ant.Project.executeTarget(Project.java:1215)
[sqlunit] at org.apache.tools.ant.Project.executeTargets(Project.java:1063
)
[sqlunit] at org.apache.tools.ant.Main.runBuild(Main.java:632)
[sqlunit] at org.apache.tools.ant.Main.startAnt(Main.java:183)
[sqlunit] at org.apache.tools.ant.launch.Launcher.run(Launcher.java:197)
[sqlunit] at org.apache.tools.ant.launch.Launcher.main(Launcher.java:56)
[sqlunit] Caused by: java.lang.ClassCastException
[sqlunit] at net.sourceforge.sqlunit.Assertions.invokeAssertion(Assertions
.java:778)
[sqlunit] at net.sourceforge.sqlunit.Assertions.assertIsTrue(Assertions.ja
va:106)
[sqlunit] at net.sourceforge.sqlunit.Assertions.assertEqual(Assertions.jav
a:160)
[sqlunit] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[sqlunit] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcces
sorImpl.java:39)
[sqlunit] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMet
hodAccessorImpl.java:25)
[sqlunit] at java.lang.reflect.Method.invoke(Method.java:324)
[sqlunit] at net.sourceforge.sqlunit.Assertions.invokeAssertion(Assertions
.java:775)
[sqlunit] ... 16 more
[sqlunit] DEBUG [main] (SQLUnitResult.java:47) - >> addFailureCount()
[sqlunit] DEBUG [main] (SQLUnitResult.java:108) - >> setLastException(e)
[sqlunit] DEBUG [main] (SymbolTable.java:96) - >> getValue(${__ElapsedMillisSt
r__})
[sqlunit] DEBUG [main] (SymbolTable.java:70) - >> getObject(${__ElapsedMillisS
tr__})
[sqlunit] DEBUG [main] (SymbolTable.java:252) - >> isVariableName(${__ElapsedM
illisStr__})
[sqlunit] DEBUG [main] (SymbolTable.java:252) - >> isVariableName(${__ElapsedM
illisStr__})
[sqlunit] (0ms)
[sqlunit] DEBUG [main] (SymbolTable.java:129) - >> getSymbols()
[sqlunit] Tearing down test...
[sqlunit] DEBUG [main] (ConnectionRegistry.java:158) - >> releaseConnections()
[sqlunit] at net.sourceforge.sqlunit.SQLUnit.runTest(SQLUnit.java:195)
[sqlunit] at net.sourceforge.sqlunit.ant.SqlunitTask.execute(SqlunitTask.j
ava:110)
[sqlunit] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.ja
va:269)
[sqlunit] at org.apache.tools.ant.Task.perform(Task.java:364)
[sqlunit] at org.apache.tools.ant.Target.execute(Target.java:301)
[sqlunit] at org.apache.tools.ant.Target.performTasks(Target.java:328)
[sqlunit] at org.apache.tools.ant.Project.executeTarget(Project.java:1215)
[sqlunit] at org.apache.tools.ant.Project.executeTargets(Project.java:1063
)
[sqlunit] at org.apache.tools.ant.Main.runBuild(Main.java:632)
[sqlunit] at org.apache.tools.ant.Main.startAnt(Main.java:183)
[sqlunit] at org.apache.tools.ant.launch.Launcher.run(Launcher.java:197)
[sqlunit] at org.apache.tools.ant.launch.Launcher.main(Launcher.java:56)
[sqlunit] Caused by: net.sourceforge.sqlunit.SQLUnitException
[sqlunit] at net.sourceforge.sqlunit.Assertions.invokeAssertion(Assertions
.java:778)
[sqlunit] at net.sourceforge.sqlunit.Assertions.assertIsTrue(Assertions.ja
va:106)
[sqlunit] at net.sourceforge.sqlunit.handlers.TestHandler.process(TestHand
ler.java:191)
[sqlunit] at net.sourceforge.sqlunit.SQLUnit.processDoc(SQLUnit.java:299)
[sqlunit] at net.sourceforge.sqlunit.SQLUnit.testWrapper(SQLUnit.java:218)
[sqlunit] ... 12 more
[sqlunit] Caused by: java.lang.ClassCastException
[sqlunit] at net.sourceforge.sqlunit.Assertions.invokeAssertion(Assertions
.java:778)
[sqlunit] at net.sourceforge.sqlunit.Assertions.assertIsTrue(Assertions.ja
va:106)
[sqlunit] at net.sourceforge.sqlunit.Assertions.assertEqual(Assertions.jav
a:160)
[sqlunit] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[sqlunit] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcces
sorImpl.java:39)
[sqlunit] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMet
hodAccessorImpl.java:25)
[sqlunit] at java.lang.reflect.Method.invoke(Method.java:324)
[sqlunit] at net.sourceforge.sqlunit.Assertions.invokeAssertion(Assertions
.java:775)
[sqlunit] ... 16 more
[sqlunit] Here is the exceptionnet.sourceforge.sqlunit.SQLUnitException: SQLUn
it Tests Failed: In file: C:\dev\V4\test/com/sf/sfv4/db/procedure/firstproctest.
xml, tests: 1, failures: 1, errors = 0
[sqlunit] net.sourceforge.sqlunit.SQLUnitException: SQLUnit Tests Failed: In f
ile: C:\dev\V4\test/com/sf/sfv4/db/procedure/firstproctest.xml, tests: 1, failur
es: 1, errors = 0
[sqlunit] at net.sourceforge.sqlunit.SQLUnit.testWrapper(SQLUnit.java:221)
[sqlunit] at net.sourceforge.sqlunit.SQLUnit.runTest(SQLUnit.java:195)
[sqlunit] at net.sourceforge.sqlunit.ant.SqlunitTask.execute(SqlunitTask.j
ava:110)
[sqlunit] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.ja
va:269)
[sqlunit] at org.apache.tools.ant.Task.perform(Task.java:364)
[sqlunit] at org.apache.tools.ant.Target.execute(Target.java:301)
[sqlunit] at org.apache.tools.ant.Target.performTasks(Target.java:328)
[sqlunit] at org.apache.tools.ant.Project.executeTarget(Project.java:1215)
[sqlunit] at org.apache.tools.ant.Project.executeTargets(Project.java:1063
)
[sqlunit] at org.apache.tools.ant.Main.runBuild(Main.java:632)
[sqlunit] at org.apache.tools.ant.Main.startAnt(Main.java:183)
[sqlunit] at org.apache.tools.ant.launch.Launcher.run(Launcher.java:197)
[sqlunit] at org.apache.tools.ant.launch.Launcher.main(Launcher.java:56)
[sqlunit] Caused by: net.sourceforge.sqlunit.SQLUnitException
[sqlunit] at net.sourceforge.sqlunit.Assertions.invokeAssertion(Assertions
.java:778)
[sqlunit] at net.sourceforge.sqlunit.Assertions.assertIsTrue(Assertions.ja
va:106)
[sqlunit] at net.sourceforge.sqlunit.handlers.TestHandler.process(TestHand
ler.java:191)
[sqlunit] at net.sourceforge.sqlunit.SQLUnit.processDoc(SQLUnit.java:299)
[sqlunit] at net.sourceforge.sqlunit.SQLUnit.testWrapper(SQLUnit.java:218)
[sqlunit] ... 12 more
[sqlunit] Caused by: java.lang.ClassCastException
[sqlunit] at net.sourceforge.sqlunit.Assertions.invokeAssertion(Assertions
.java:778)
[sqlunit] at net.sourceforge.sqlunit.Assertions.assertIsTrue(Assertions.ja
va:106)
[sqlunit] at net.sourceforge.sqlunit.Assertions.assertEqual(Assertions.jav
a:160)
[sqlunit] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[sqlunit] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcces
sorImpl.java:39)
[sqlunit] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMet
hodAccessorImpl.java:25)
[sqlunit] at java.lang.reflect.Method.invoke(Method.java:324)
[sqlunit] at net.sourceforge.sqlunit.Assertions.invokeAssertion(Assertions
.java:775)
[sqlunit] ... 16 more
[sqlunit] Here is the message of the exception --MESSAGE SQLUnit Tests Failed:
In file: C:\dev\V4\test/com/sf/sfv4/db/procedure/firstproctest.xml, tests: 1, f
ailures: 1, errors = 0
[sqlunit] SQLUnit Tests Failed: In file: C:\dev\V4\test/com/sf/sfv4/db/procedu
re/firstproctest.xml, tests: 1, failures: 1, errors = 0
[sqlunit] net.sourceforge.sqlunit.SQLUnitException: SQLUnit Tests Failed: In f
ile: C:\dev\V4\test/com/sf/sfv4/db/procedure/firstproctest.xml, tests: 1, failur
es: 1, errors = 0
[sqlunit] at net.sourceforge.sqlunit.SQLUnit.testWrapper(SQLUnit.java:221)
[sqlunit] at net.sourceforge.sqlunit.SQLUnit.runTest(SQLUnit.java:195)
[sqlunit] at net.sourceforge.sqlunit.ant.SqlunitTask.execute(SqlunitTask.j
ava:110)
[sqlunit] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.ja
va:269)
[sqlunit] at org.apache.tools.ant.Task.perform(Task.java:364)
[sqlunit] at org.apache.tools.ant.Target.execute(Target.java:301)
[sqlunit] at org.apache.tools.ant.Target.performTasks(Target.java:328)
[sqlunit] at org.apache.tools.ant.Project.executeTarget(Project.java:1215)
[sqlunit] at org.apache.tools.ant.Project.executeTargets(Project.java:1063
)
[sqlunit] at org.apache.tools.ant.Main.runBuild(Main.java:632)
[sqlunit] at org.apache.tools.ant.Main.startAnt(Main.java:183)
[sqlunit] at org.apache.tools.ant.launch.Launcher.run(Launcher.java:197)
[sqlunit] at org.apache.tools.ant.launch.Launcher.main(Launcher.java:56)
[sqlunit] Caused by: net.sourceforge.sqlunit.SQLUnitException
[sqlunit] at net.sourceforge.sqlunit.Assertions.invokeAssertion(Assertions
.java:778)
[sqlunit] at net.sourceforge.sqlunit.Assertions.assertIsTrue(Assertions.ja
va:106)
[sqlunit] at net.sourceforge.sqlunit.handlers.TestHandler.process(TestHand
ler.java:191)
[sqlunit] at net.sourceforge.sqlunit.SQLUnit.processDoc(SQLUnit.java:299)
[sqlunit] at net.sourceforge.sqlunit.SQLUnit.testWrapper(SQLUnit.java:218)
[sqlunit] ... 12 more
[sqlunit] Caused by: java.lang.ClassCastException
[sqlunit] at net.sourceforge.sqlunit.Assertions.invokeAssertion(Assertions
.java:778)
[sqlunit] at net.sourceforge.sqlunit.Assertions.assertIsTrue(Assertions.ja
va:106)
[sqlunit] at net.sourceforge.sqlunit.Assertions.assertEqual(Assertions.jav
a:160)
[sqlunit] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[sqlunit] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcces
sorImpl.java:39)
[sqlunit] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMet
hodAccessorImpl.java:25)
[sqlunit] at java.lang.reflect.Method.invoke(Method.java:324)
[sqlunit] at net.sourceforge.sqlunit.Assertions.invokeAssertion(Assertions
.java:775)
[sqlunit] ... 16 more
[sqlunit] SQLUnit Tests Failed: In file: C:\dev\V4\test/com/sf/sfv4/db/procedu
re/firstproctest.xml, tests: 1, failures: 1, errors = 0
I see this in the trace you sent me, looks like the stored procedure did not compile?
[sqlunit] DEBUG [main] (DatabaseResult.java:165) - >>
resetAsException(6550,ORA-06550: line 1, column 18:
[sqlunit] PLS-00103: Encountered the symbol "." when expecting one of the following:
[sqlunit] := . ( @ % ;
[sqlunit] The symbol ":= was inserted before "." to continue.
[sqlunit] )
I still have to look at the ClassCastException, not sure where thats coming from.
The correct behavior, imo, would be for it to say that you specified a result, but it got an exception. Also are you returning anything from the stored procedure? If its only the outparam you are interested in, you should specify an outparam in the result.
I will look at this some more this evening and let you know tomorrow.
-sujit
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
By taking the the extra dot "." from the procedure call eliminates the symbol problem. But there is still the ClassCastException(). Thanks for your help
Below is the modified statement.
-------------------------------------------
<call>
<stmt>{call USERDAO_PKG.getPasswordSP(?,?)}</stmt>
<param id="1" inout="in" type="VARCHAR">super</param>
<param id="2" inout="inout" type="VARCHAR">${OUT_PASSWORD}</param>
</call>
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I see where the ClassCastException was coming from, it was trying to cast a Throwable to an Exception in the InvocationTargetExeception catch block. This was because till 4.0, the SQLUnitException could be constructed only with an embedded Exception object, but since then, I have changed this to accept a Throwable. It sounds kind of dumb looking back on it now, but casting it down to an Exception was my way to get around that at the time. I have fixed that (removed the cast) and if you download from CVS and rebuild the JAR file, you should have no problems.
If you decide to rebuild the JAR file, remember to delete the sqlunit-4.0.jar file that you already have before running ant install. I should really make the build script tell you this instead of telling everybody this via email :-).
Now it should give you an exception, but it should be more related to the problem with the stored procedure and its results.
-sujit
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am using sybase11.0.3 and SQLUnit 1.8. How to pass a value got from previous test result to
the next test.
<param id="2" type="VARCHAR">${ReqId}</param>
is not working.
It is taking ${ReqId} as string not as a variable.
Please tell how to pass variable as input parameter
If in an earlier test, the sproc returns a variable which you store in ${ReqId}, then you should be able to use the value of ReqId in a later test.
You can also set the value of ReqId using the set element, which sets it to an initial value. Can you provide more details, such as the test element of the test which generates the ${ReqId} variable and the test element for the test which uses it?
BTW, as mentioned in my previous mail, please post to the forum, that way your problem gets more visibility.
Thanks
Sujit
<test name="Running sp_Test">
<call>
<stmt>{? = call SuperSevaTest..sp_Test(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}</stmt>
<param id="1" type="INTEGER" inout="out">${status}</param>
<param id="2" type="CHAR">1097130112605841</param>
<param id="3" type="VARCHAR">C1</param>
<param id="4" type="VARCHAR">1234</param>
<param id="5" type="CHAR">D</param>
<param id="6" type="TIMESTAMP">2003-09-29 00:00:00.000</param>
<param id="7" type="NUMERIC">1000</param>
<param id="8" type="NUMERIC">1</param>
<param id="9" type="NUMERIC">4</param>
<param id="10" type="CHAR">1097130112605841</param>
<param id="11" type="VARCHAR">Testing</param>
<param id="12" type="TIMESTAMP">1900-01-01 00:00:00.000</param>
<param id="13" type="NUMERIC">0</param>
<param id="14" type="VARCHAR" inout="out">${ReqIdV}</param>
<param id="15" type="INTEGER" inout="out">${errorCode}</param>
<param id="16" type="VARCHAR" inout="out">${errorDesc}</param>
</call>
<result>
<outparam id="1" type="INTEGER">0</outparam>
<resultset id="1">
<row id="1">
<col id="1" name="" type="VARCHAR">${ReqIdV}</col>
</row>
</resultset>
<outparam id="15" type="INTEGER">0</outparam>
<outparam id="16" type="VARCHAR">success</outparam>
<resultset id="1">
<row id="1">
<col id="1" name="RequestTypeId" type="NUMERIC">4</col>
</row>
</resultset>
</result>
</test>
<test name="Running sp_convertToNumeric">
<call>
<stmt>{? = call SuperSevaTest..sp_convertToNumeric(?,?)}</stmt>
<param id="1" type="INTEGER" inout="out">${rc}</param>
<param id="2" type="VARCHAR">${ReqIdV}</param>
<param id="3" type="INTEGER" inout="out">${ReqId}</param>
</call>
<result />
</test>
If I run these 2 tests it is giving me an error like the following
*** expected:
[sqlunit] <result />
[sqlunit] *** but got:
[sqlunit] <result>
[sqlunit] <exception>
[sqlunit] <code>249</code>
[sqlunit] <message>Syntax error during explicit conversion of VARCHAR value '${ReqIdV}' to a NUMERIC field.</message>
I think is not taking value of a variable ${ReqIdV}.But it is considering ${ReqIdV} as string.
So please tell how to solve this problem.
and oner more thing ,In the 1st test case I am inserting some value to NUMERIC i.e 0 and to TIMESTAMP field.
But actually I don't want to insert anything to those fields in the database.So how to do that.I can't leave those fields as blank in this test case
Advanced thanks
I created a bug for this:
https://sourceforge.net/tracker/index.php?func=detail&aid=812898&group_id=77832&atid=551357
and fixed it. The bug contains the reason why this was appearing if you are interested.
-sujit
> and oner more thing ,In the 1st test case I am
> inserting some value to NUMERIC i.e 0 and to TIMESTAMP field.
> But actually I don't want to insert anything to those
> fields in the database.So how to do that.I can't leave
> those fields as blank in this test case
Not sure about what you are asking, but Sybase has a method of supplying default arguments (similar to C++) in its argument list, so if you were to say that @numvar integer=0 inside your argument list, then you would not have to declare it in the call, it would be automatically defaulted to 0.
Or are you asking how to set a input argument to null? Didn't think of that, but we could have the string [Nn][Uu][Ll][Ll] indicate a null value for input params. However, that puts a kink for tests that need to use a string "NULL". Suggestions?
-sujit
Looked at the code, and the functionality already exists. If you specify the element text of the <param> element as NULL, then it will be considered a NULL. Release 2.1 will also have a new <param> attribute is-null which has the same behavior. Of course this means that input params which are string "NULL" will not work, but I dont want to take this out because of backward compatibility issues.
Hi All, I am new to SQLUNIT and trying to test a simple stored proc. In doing so I am getting a classCastException().
the userId is "super" and the password I am expecting is "super"
Any help will be greatly appreciated
thanks,
kwadwo
-----------------------------------
Below is the stored proc
-----------------------------------
procedure getPasswordSP(
in_users_sys_id in change_on_setup.users_sysinfo.users_sys_id%TYPE,
out_password in out change_on_setup.users_sysinfo.users_sys_password%TYPE);
----------------------------------------
Here is my xml:
--------------------------------------------------
<?xml version="1.0"?>
<!DOCTYPE sqlunit SYSTEM "file:src/com/sf/dtd/sqlunit.dtd">
<sqlunit>
<connection>
<driver>oracle.jdbc.driver.OracleDriver</driver>
<url>jdbc:oracle:thin:@10.1.0.53:1521:sfdb1</url>
<user>pk_super</user>
<password>pk_super</password>
</connection>
<test name="Find User Password" failure-message="Failed to find user-password">
<call>
<stmt>{call USERDAO_PKG..getPasswordSP(?,?)}</stmt>
<param id="1" inout="in" type="VARCHAR">super</param>
<param id="2" inout="inout" type="VARCHAR">${OUT_PASSWORD}</param>
</call>
<result>
<resultset id="1">
<row id="1">
<col id="2" type="VARCHAR">super</col>
</row>
</resultset>
</result>
</test>
</sqlunit>
-------------------------------------------
Below is the Output I am getting
-------------------------------------------
sqlunit-test:
[sqlunit] WARN [main] (SQLUnit.java:158) - log4j.properties not found (using
defaults)
[sqlunit] WE are in the TEST WRAPPER
[sqlunit] DEBUG [main] (SQLUnit.java:217) - >> testWrapper()
[sqlunit] DEBUG [main] (SQLUnit.java:239) - >> processDoc()
[sqlunit] DEBUG [main] (TypeMapper.java:67) - instantiating TypeMapper
[sqlunit] DEBUG [main] (TypeMapper.java:189) - loading types from: net.sourcef
orge.sqlunit.types
[sqlunit] DEBUG [main] (TypeMapper.java:189) - loading types from: usertypes
[sqlunit] DEBUG [main] (TypeMapper.java:221) - loading non-mapped types
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: -7
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: -7
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: BIT
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: -6
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: -6
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: TINYINT
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: 5
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: 5
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: SMALLINT
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: 4
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: 4
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: INTEGER
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: -5
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: -5
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: BIGINT
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: 6
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: 6
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: FLOAT
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: 7
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: 7
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: REAL
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: 8
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: 8
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: DOUBLE
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: 2
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: 2
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: NUMERIC
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: 3
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: 3
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: DECIMAL
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: 1
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: 1
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: CHAR
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: 12
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: 12
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: VARCHAR
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: -1
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: -1
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: LONGVARCH
AR
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: 91
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: 91
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: DATE
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: 92
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: 92
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: TIME
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: 93
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: 93
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: TIMESTAMP
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: -2
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: -2
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: BINARY
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: -3
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: -3
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: VARBINARY
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: -4
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: -4
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: LONGVARBI
NARY
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: 0
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: 0
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: NULL
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: 1111
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: 1111
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: OTHER
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: 2000
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: 2000
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: JAVA_OBJE
CT
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: 2001
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: 2001
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: null
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: 2002
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: 2002
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: null
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: 2003
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: 2003
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: ARRAY
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: 2004
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: 2004
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: BLOB
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: 2005
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: 2005
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: CLOB
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: 2006
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: 2006
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: null
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: 70
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: 70
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: null
[sqlunit] DEBUG [main] (TypeMapper.java:102) - finding class by id: 16
[sqlunit] DEBUG [main] (TypeMapper.java:114) - finding name by id: 16
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: BOOLEAN
[sqlunit] DEBUG [main] (SQLUnitResult.java:126) - >> setTestFile(C:\dev\V4\tes
t/com/sf/sfv4/db/procedure/firstproctest.xml)
[sqlunit] *** Running SQLUnit file: C:\dev\V4\test/com/sf/sfv4/db/procedure/fi
rstproctest.xml
[sqlunit] DEBUG [main] (ConnectionRegistry.java:55) - >> getConnectionById(nul
l)
[sqlunit] Getting connection(DEFAULT)
[sqlunit] DEBUG [main] (HandlerFactory.java:52) - >> getInstance(connection)
[sqlunit] DEBUG [main] (ConnectionHandler.java:181) - >> process()
[sqlunit] DEBUG [main] (XMLUtils.java:53) - >> getAttributeValue(Element conne
ction,connection-id)
[sqlunit] DEBUG [main] (SymbolTable.java:252) - >> isVariableName(null)
[sqlunit] DEBUG [main] (XMLUtils.java:53) - >> getAttributeValue(Element conne
ction,extern)
[sqlunit] DEBUG [main] (SymbolTable.java:252) - >> isVariableName(null)
[sqlunit] DEBUG [main] (XMLUtils.java:53) - >> getAttributeValue(Element conne
ction,transaction-support)
[sqlunit] DEBUG [main] (SymbolTable.java:252) - >> isVariableName(on)
[sqlunit] DEBUG [main] (XMLUtils.java:53) - >> getAttributeValue(Element conne
ction,reconnect-on-failure)
[sqlunit] DEBUG [main] (SymbolTable.java:252) - >> isVariableName(off)
[sqlunit] DEBUG [main] (XMLUtils.java:53) - >> getAttributeValue(Element conne
ction,server-name)
[sqlunit] DEBUG [main] (SymbolTable.java:252) - >> isVariableName(null)
[sqlunit] DEBUG [main] (XMLUtils.java:77) - >> getText(Element driver)
[sqlunit] DEBUG [main] (SymbolTable.java:252) - >> isVariableName(oracle.jdbc.
driver.OracleDriver)
[sqlunit] DEBUG [main] (XMLUtils.java:77) - >> getText(Element url)
[sqlunit] DEBUG [main] (SymbolTable.java:252) - >> isVariableName(jdbc:oracle:
thin:@10.1.0.53:1521:sfdb1)
[sqlunit] DEBUG [main] (XMLUtils.java:77) - >> getText(Element user)
[sqlunit] DEBUG [main] (SymbolTable.java:252) - >> isVariableName(pk_super)
[sqlunit] DEBUG [main] (XMLUtils.java:77) - >> getText(Element password)
[sqlunit] DEBUG [main] (SymbolTable.java:252) - >> isVariableName(pk_super)
[sqlunit] DEBUG [main] (ConnectionRegistry.java:113) - >> setConnectionById(nu
ll)
[sqlunit] DEBUG [main] (ConnectionFactory.java:56) - >> getInstance(props)
[sqlunit] DEBUG [main] (ConnectionRegistry.java:55) - >> getConnectionById(nul
l)
[sqlunit] Setting up test...
[sqlunit] DEBUG [main] (SQLUnitResult.java:63) - >> addRunCount()
[sqlunit] DEBUG [main] (HandlerFactory.java:52) - >> getInstance(test)
[sqlunit] Here is the name being returned##########
[sqlunit] DEBUG [main] (TestHandler.java:143) - >> process(elTest)
[sqlunit] DEBUG [main] (XMLUtils.java:53) - >> getAttributeValue(Element test,
java-object-support)
[sqlunit] DEBUG [main] (SymbolTable.java:252) - >> isVariableName(off)
[sqlunit] DEBUG [main] (XMLUtils.java:53) - >> getAttributeValue(Element test,
java-object-support)
[sqlunit] DEBUG [main] (SymbolTable.java:252) - >> isVariableName(off)
[sqlunit] DEBUG [main] (SymbolTable.java:120) - >> setValue(${__JavaObjectSupp
ort__},off)
[sqlunit] DEBUG [main] (XMLUtils.java:53) - >> getAttributeValue(Element test,
failure-message)
[sqlunit] DEBUG [main] (SymbolTable.java:252) - >> isVariableName(Failed to fi
nd user-password)
[sqlunit] DEBUG [main] (XMLUtils.java:53) - >> getAttributeValue(Element test,
name)
[sqlunit] DEBUG [main] (SymbolTable.java:252) - >> isVariableName(Find User Pa
ssword)
[sqlunit] DEBUG [main] (XMLUtils.java:53) - >> getAttributeValue(Element test,
expected-duration-millis)
[sqlunit] DEBUG [main] (SymbolTable.java:252) - >> isVariableName(null)
[sqlunit] DEBUG [main] (XMLUtils.java:53) - >> getAttributeValue(Element test,
percentage-tolerance)
[sqlunit] DEBUG [main] (SymbolTable.java:252) - >> isVariableName(null)
[sqlunit] DEBUG [main] (XMLUtils.java:53) - >> getAttributeValue(Element test,
assert)
[sqlunit] DEBUG [main] (SymbolTable.java:252) - >> isVariableName(null)
[sqlunit] DEBUG [main] (HandlerFactory.java:52) - >> getInstance(call)
[sqlunit] DEBUG [main] (CallHandler.java:108) - >> process()
[sqlunit] DEBUG [main] (XMLUtils.java:53) - >> getAttributeValue(Element call,
connection-id)
[sqlunit] DEBUG [main] (SymbolTable.java:252) - >> isVariableName(null)
[sqlunit] DEBUG [main] (XMLUtils.java:77) - >> getText(Element stmt)
[sqlunit] DEBUG [main] (SymbolTable.java:252) - >> isVariableName({call USERDA
O_PKG..getPasswordSP(?,?)})
[sqlunit] DEBUG [main] (SymbolTable.java:263) - >> replaceVariables({call USER
DAO_PKG..getPasswordSP(?,?)})
[sqlunit] DEBUG [main] (SymbolTable.java:129) - >> getSymbols()
[sqlunit] DEBUG [main] (SymbolTable.java:96) - >> getValue(${__JavaObjectSuppo
rt__})
[sqlunit] DEBUG [main] (SymbolTable.java:70) - >> getObject(${__JavaObjectSupp
ort__})
[sqlunit] DEBUG [main] (SymbolTable.java:252) - >> isVariableName(${__JavaObje
ctSupport__})
[sqlunit] DEBUG [main] (SymbolTable.java:252) - >> isVariableName(${__JavaObje
ctSupport__})
[sqlunit] DEBUG [main] (HandlerFactory.java:52) - >> getInstance(param)
[sqlunit] DEBUG [main] (ParamHandler.java:94) - >> process(elParam)
[sqlunit] DEBUG [main] (XMLUtils.java:53) - >> getAttributeValue(Element param
,id)
[sqlunit] DEBUG [main] (SymbolTable.java:252) - >> isVariableName(1)
[sqlunit] DEBUG [main] (XMLUtils.java:53) - >> getAttributeValue(Element param
,name)
[sqlunit] DEBUG [main] (SymbolTable.java:252) - >> isVariableName(null)
[sqlunit] DEBUG [main] (XMLUtils.java:53) - >> getAttributeValue(Element param
,type)
[sqlunit] DEBUG [main] (SymbolTable.java:252) - >> isVariableName(VARCHAR)
[sqlunit] DEBUG [main] (XMLUtils.java:53) - >> getAttributeValue(Element param
,is-null)
[sqlunit] DEBUG [main] (SymbolTable.java:252) - >> isVariableName(false)
[sqlunit] DEBUG [main] (XMLUtils.java:53) - >> getAttributeValue(Element param
,inout)
[sqlunit] DEBUG [main] (SymbolTable.java:252) - >> isVariableName(in)
[sqlunit] DEBUG [main] (XMLUtils.java:77) - >> getText(Element param)
[sqlunit] DEBUG [main] (SymbolTable.java:252) - >> isVariableName(super)
[sqlunit] DEBUG [main] (SqlHandler.java:142) - executeSQL(null,{call USERDAO_P
KG..getPasswordSP(?,?)},params)
[sqlunit] &&&& executeSQL(null,{call USERDAO_PKG..getPasswordSP(?,?)},params=
net.sourceforge.sqlunit.beans.Param@b30913
[sqlunit] DEBUG [main] (ConnectionRegistry.java:55) - >> getConnectionById(nul
l)
[sqlunit] Here is the connection oracle.jdbc.driver.OracleConnection@18f51f
[sqlunit] DEBUG [main] (TypeUtils.java:113) - >> convertToObject(super,VARCHAR
)
[sqlunit] DEBUG [main] (SymbolTable.java:252) - >> isVariableName(super)
[sqlunit] DEBUG [main] (TypeFactory.java:51) - >> getInstance(VARCHAR)
[sqlunit] DEBUG [main] (TypeFactory.java:73) - Looking up oracle.VARCHAR
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: oracle.VA
RCHAR
[sqlunit] DEBUG [main] (TypeFactory.java:75) - found a typeClass: null
[sqlunit] DEBUG [main] (TypeFactory.java:79) - Falling back on basic type look
up for VARCHAR
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: VARCHAR
[sqlunit] DEBUG [main] (TypeFactory.java:88) - Instantiating a net.sourceforge
.sqlunit.types.StringType
[sqlunit] DEBUG [main] (TypeMapper.java:155) - finding id by name: VARCHAR
[sqlunit] DEBUG [main] (TypeUtils.java:96) - >> getSqlTypeFromXmlType(VARCHAR)
[sqlunit] DEBUG [main] (TypeMapper.java:155) - finding id by name: VARCHAR
[sqlunit] DEBUG [main] (DatabaseResult.java:55) - [DatabaseResult]
[sqlunit] DEBUG [main] (ConnectionRegistry.java:135) - >> invalidate(null)
[sqlunit] DEBUG [main] (DatabaseResult.java:165) - >> resetAsException(6550,OR
A-06550: line 1, column 18:
[sqlunit] PLS-00103: Encountered the symbol "." when expecting one of the foll
owing:
[sqlunit]
[sqlunit] := . ( @ % ;
[sqlunit] The symbol ":= was inserted before "." to continue.
[sqlunit] )
[sqlunit] DEBUG [main] (HandlerFactory.java:52) - >> getInstance(result)
[sqlunit] DEBUG [main] (ResultHandler.java:144) - >> process(elResult)
[sqlunit] DEBUG [main] (DatabaseResult.java:55) - [DatabaseResult]
[sqlunit] DEBUG [main] (HandlerFactory.java:52) - >> getInstance(resultset)
[sqlunit] DEBUG [main] (ResultSetHandler.java:94) - >> process(elResultSet)
[sqlunit] DEBUG [main] (XMLUtils.java:53) - >> getAttributeValue(Element resul
tset,id)
[sqlunit] DEBUG [main] (SymbolTable.java:252) - >> isVariableName(1)
[sqlunit] DEBUG [main] (XMLUtils.java:53) - >> getAttributeValue(Element resul
tset,rowcount)
[sqlunit] DEBUG [main] (SymbolTable.java:252) - >> isVariableName(null)
[sqlunit] DEBUG [main] (HandlerFactory.java:52) - >> getInstance(row)
[sqlunit] DEBUG [main] (RowHandler.java:74) - >> process(elRow)
[sqlunit] DEBUG [main] (XMLUtils.java:53) - >> getAttributeValue(Element row,i
d)
[sqlunit] DEBUG [main] (SymbolTable.java:252) - >> isVariableName(1)
[sqlunit] DEBUG [main] (HandlerFactory.java:52) - >> getInstance(col)
[sqlunit] DEBUG [main] (ColHandler.java:72) - >> process(elCol)
[sqlunit] DEBUG [main] (XMLUtils.java:53) - >> getAttributeValue(Element col,i
d)
[sqlunit] DEBUG [main] (SymbolTable.java:252) - >> isVariableName(2)
[sqlunit] DEBUG [main] (XMLUtils.java:53) - >> getAttributeValue(Element col,n
ame)
[sqlunit] DEBUG [main] (SymbolTable.java:252) - >> isVariableName(null)
[sqlunit] DEBUG [main] (XMLUtils.java:53) - >> getAttributeValue(Element col,t
ype)
[sqlunit] DEBUG [main] (SymbolTable.java:252) - >> isVariableName(VARCHAR)
[sqlunit] DEBUG [main] (TypeFactory.java:51) - >> getInstance(VARCHAR)
[sqlunit] DEBUG [main] (TypeFactory.java:73) - Looking up oracle.VARCHAR
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: oracle.VA
RCHAR
[sqlunit] DEBUG [main] (TypeFactory.java:75) - found a typeClass: null
[sqlunit] DEBUG [main] (TypeFactory.java:79) - Falling back on basic type look
up for VARCHAR
[sqlunit] DEBUG [main] (TypeMapper.java:92) - finding class by name: VARCHAR
[sqlunit] DEBUG [main] (TypeFactory.java:88) - Instantiating a net.sourceforge
.sqlunit.types.StringType
[sqlunit] DEBUG [main] (TypeMapper.java:155) - finding id by name: VARCHAR
[sqlunit] DEBUG [main] (XMLUtils.java:53) - >> getAttributeValue(Element resul
tset,order-by)
[sqlunit] DEBUG [main] (SymbolTable.java:252) - >> isVariableName(null)
[sqlunit] DEBUG [main] (SymbolTable.java:120) - >> setValue(${__JavaObjectSupp
ort__},null)
[sqlunit] DEBUG [main] (SymbolTable.java:200) - >> update(target,source)
[sqlunit] DEBUG [main] (SymbolTable.java:209) - looking at colValue: super
[sqlunit] DEBUG [main] (SymbolTable.java:252) - >> isVariableName(super)
[sqlunit] DEBUG [main] (SymbolTable.java:330) - >> dump()
[sqlunit] DEBUG [main] (SymbolTable.java:129) - >> getSymbols()
[sqlunit] DEBUG [main] (SymbolTable.java:332) -
[sqlunit] Symbol table dump
[sqlunit] DEBUG [main] (SymbolTable.java:333) - -----------------
[sqlunit] DEBUG [main] (SymbolTable.java:341) - ${__JavaObjectSupport__} => nu
ll
[sqlunit] DEBUG [main] (SymbolTable.java:343) - -----------------
[sqlunit] DEBUG [main] (DatabaseResult.java:147) - >> isException()
[sqlunit] DEBUG [main] (DatabaseResult.java:147) - >> isException()
[sqlunit] DEBUG [main] (DatabaseResult.java:237) - >> toString()
[sqlunit] DEBUG [main] (DatabaseResult.java:199) - >> toElement()
[sqlunit] DEBUG [main] (DatabaseResult.java:147) - >> isException()
[sqlunit] DEBUG [main] (DatabaseResult.java:181) - >> getUpdateCount()
[sqlunit] Running test[1]: Find User Passwordnet.sourceforge.sqlunit.SQLUnitEx
ception
[sqlunit] at net.sourceforge.sqlunit.Assertions.invokeAssertion(Assertions
.java:778)
[sqlunit] at net.sourceforge.sqlunit.Assertions.assertIsTrue(Assertions.ja
va:106)
[sqlunit] at net.sourceforge.sqlunit.handlers.TestHandler.process(TestHand
ler.java:191)
[sqlunit] at net.sourceforge.sqlunit.SQLUnit.processDoc(SQLUnit.java:299)
[sqlunit] at net.sourceforge.sqlunit.SQLUnit.testWrapper(SQLUnit.java:218)
[sqlunit] at net.sourceforge.sqlunit.SQLUnit.runTest(SQLUnit.java:195)
[sqlunit] at net.sourceforge.sqlunit.ant.SqlunitTask.execute(SqlunitTask.j
ava:110)
[sqlunit] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.ja
va:269)
[sqlunit] at org.apache.tools.ant.Task.perform(Task.java:364)
[sqlunit] at org.apache.tools.ant.Target.execute(Target.java:301)
[sqlunit] at org.apache.tools.ant.Target.performTasks(Target.java:328)
[sqlunit] at org.apache.tools.ant.Project.executeTarget(Project.java:1215)
[sqlunit] at org.apache.tools.ant.Project.executeTargets(Project.java:1063
)
[sqlunit] at org.apache.tools.ant.Main.runBuild(Main.java:632)
[sqlunit] at org.apache.tools.ant.Main.startAnt(Main.java:183)
[sqlunit] at org.apache.tools.ant.launch.Launcher.run(Launcher.java:197)
[sqlunit] at org.apache.tools.ant.launch.Launcher.main(Launcher.java:56)
[sqlunit] Caused by: java.lang.ClassCastException
[sqlunit] at net.sourceforge.sqlunit.Assertions.invokeAssertion(Assertions
.java:778)
[sqlunit] at net.sourceforge.sqlunit.Assertions.assertIsTrue(Assertions.ja
va:106)
[sqlunit] at net.sourceforge.sqlunit.Assertions.assertEqual(Assertions.jav
a:160)
[sqlunit] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[sqlunit] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcces
sorImpl.java:39)
[sqlunit] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMet
hodAccessorImpl.java:25)
[sqlunit] at java.lang.reflect.Method.invoke(Method.java:324)
[sqlunit] at net.sourceforge.sqlunit.Assertions.invokeAssertion(Assertions
.java:775)
[sqlunit] ... 16 more
[sqlunit] DEBUG [main] (SQLUnitResult.java:47) - >> addFailureCount()
[sqlunit] DEBUG [main] (SQLUnitResult.java:108) - >> setLastException(e)
[sqlunit] DEBUG [main] (SymbolTable.java:96) - >> getValue(${__ElapsedMillisSt
r__})
[sqlunit] DEBUG [main] (SymbolTable.java:70) - >> getObject(${__ElapsedMillisS
tr__})
[sqlunit] DEBUG [main] (SymbolTable.java:252) - >> isVariableName(${__ElapsedM
illisStr__})
[sqlunit] DEBUG [main] (SymbolTable.java:252) - >> isVariableName(${__ElapsedM
illisStr__})
[sqlunit] (0ms)
[sqlunit] DEBUG [main] (SymbolTable.java:129) - >> getSymbols()
[sqlunit] Tearing down test...
[sqlunit] DEBUG [main] (ConnectionRegistry.java:158) - >> releaseConnections()
[sqlunit] DEBUG [main] (SQLUnitResult.java:90) - >> errorCount()
[sqlunit] DEBUG [main] (SQLUnitResult.java:81) - >> failureCount()
[sqlunit] DEBUG [main] (SQLUnitResult.java:135) - >> wasSuccessful()
[sqlunit] DEBUG [main] (SQLUnitResult.java:90) - >> errorCount()
[sqlunit] DEBUG [main] (SQLUnitResult.java:81) - >> failureCount()
[sqlunit] DEBUG [main] (SQLUnitResult.java:144) - >> toString()
[sqlunit] DEBUG [main] (SQLUnitResult.java:99) - >> getLastException()
[sqlunit] FATAL [main] (SQLUnit.java:198) - SQLUnit Tests Failed: In file: C:\
dev\V4\test/com/sf/sfv4/db/procedure/firstproctest.xml, tests: 1, failures: 1, e
rrors = 0
[sqlunit] net.sourceforge.sqlunit.SQLUnitException: SQLUnit Tests Failed: In f
ile: C:\dev\V4\test/com/sf/sfv4/db/procedure/firstproctest.xml, tests: 1, failur
es: 1, errors = 0
[sqlunit] at net.sourceforge.sqlunit.SQLUnit.testWrapper(SQLUnit.java:221)
[sqlunit] at net.sourceforge.sqlunit.SQLUnit.runTest(SQLUnit.java:195)
[sqlunit] at net.sourceforge.sqlunit.ant.SqlunitTask.execute(SqlunitTask.j
ava:110)
[sqlunit] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.ja
va:269)
[sqlunit] at org.apache.tools.ant.Task.perform(Task.java:364)
[sqlunit] at org.apache.tools.ant.Target.execute(Target.java:301)
[sqlunit] at org.apache.tools.ant.Target.performTasks(Target.java:328)
[sqlunit] at org.apache.tools.ant.Project.executeTarget(Project.java:1215)
[sqlunit] at org.apache.tools.ant.Project.executeTargets(Project.java:1063
)
[sqlunit] at org.apache.tools.ant.Main.runBuild(Main.java:632)
[sqlunit] at org.apache.tools.ant.Main.startAnt(Main.java:183)
[sqlunit] at org.apache.tools.ant.launch.Launcher.run(Launcher.java:197)
[sqlunit] at org.apache.tools.ant.launch.Launcher.main(Launcher.java:56)
[sqlunit] Caused by: net.sourceforge.sqlunit.SQLUnitException
[sqlunit] at net.sourceforge.sqlunit.Assertions.invokeAssertion(Assertions
.java:778)
[sqlunit] at net.sourceforge.sqlunit.Assertions.assertIsTrue(Assertions.ja
va:106)
[sqlunit] at net.sourceforge.sqlunit.handlers.TestHandler.process(TestHand
ler.java:191)
[sqlunit] at net.sourceforge.sqlunit.SQLUnit.processDoc(SQLUnit.java:299)
[sqlunit] at net.sourceforge.sqlunit.SQLUnit.testWrapper(SQLUnit.java:218)
[sqlunit] ... 12 more
[sqlunit] Caused by: java.lang.ClassCastException
[sqlunit] at net.sourceforge.sqlunit.Assertions.invokeAssertion(Assertions
.java:778)
[sqlunit] at net.sourceforge.sqlunit.Assertions.assertIsTrue(Assertions.ja
va:106)
[sqlunit] at net.sourceforge.sqlunit.Assertions.assertEqual(Assertions.jav
a:160)
[sqlunit] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[sqlunit] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcces
sorImpl.java:39)
[sqlunit] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMet
hodAccessorImpl.java:25)
[sqlunit] at java.lang.reflect.Method.invoke(Method.java:324)
[sqlunit] at net.sourceforge.sqlunit.Assertions.invokeAssertion(Assertions
.java:775)
[sqlunit] ... 16 more
[sqlunit] Here is the exceptionnet.sourceforge.sqlunit.SQLUnitException: SQLUn
it Tests Failed: In file: C:\dev\V4\test/com/sf/sfv4/db/procedure/firstproctest.
xml, tests: 1, failures: 1, errors = 0
[sqlunit] net.sourceforge.sqlunit.SQLUnitException: SQLUnit Tests Failed: In f
ile: C:\dev\V4\test/com/sf/sfv4/db/procedure/firstproctest.xml, tests: 1, failur
es: 1, errors = 0
[sqlunit] at net.sourceforge.sqlunit.SQLUnit.testWrapper(SQLUnit.java:221)
[sqlunit] at net.sourceforge.sqlunit.SQLUnit.runTest(SQLUnit.java:195)
[sqlunit] at net.sourceforge.sqlunit.ant.SqlunitTask.execute(SqlunitTask.j
ava:110)
[sqlunit] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.ja
va:269)
[sqlunit] at org.apache.tools.ant.Task.perform(Task.java:364)
[sqlunit] at org.apache.tools.ant.Target.execute(Target.java:301)
[sqlunit] at org.apache.tools.ant.Target.performTasks(Target.java:328)
[sqlunit] at org.apache.tools.ant.Project.executeTarget(Project.java:1215)
[sqlunit] at org.apache.tools.ant.Project.executeTargets(Project.java:1063
)
[sqlunit] at org.apache.tools.ant.Main.runBuild(Main.java:632)
[sqlunit] at org.apache.tools.ant.Main.startAnt(Main.java:183)
[sqlunit] at org.apache.tools.ant.launch.Launcher.run(Launcher.java:197)
[sqlunit] at org.apache.tools.ant.launch.Launcher.main(Launcher.java:56)
[sqlunit] Caused by: net.sourceforge.sqlunit.SQLUnitException
[sqlunit] at net.sourceforge.sqlunit.Assertions.invokeAssertion(Assertions
.java:778)
[sqlunit] at net.sourceforge.sqlunit.Assertions.assertIsTrue(Assertions.ja
va:106)
[sqlunit] at net.sourceforge.sqlunit.handlers.TestHandler.process(TestHand
ler.java:191)
[sqlunit] at net.sourceforge.sqlunit.SQLUnit.processDoc(SQLUnit.java:299)
[sqlunit] at net.sourceforge.sqlunit.SQLUnit.testWrapper(SQLUnit.java:218)
[sqlunit] ... 12 more
[sqlunit] Caused by: java.lang.ClassCastException
[sqlunit] at net.sourceforge.sqlunit.Assertions.invokeAssertion(Assertions
.java:778)
[sqlunit] at net.sourceforge.sqlunit.Assertions.assertIsTrue(Assertions.ja
va:106)
[sqlunit] at net.sourceforge.sqlunit.Assertions.assertEqual(Assertions.jav
a:160)
[sqlunit] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[sqlunit] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcces
sorImpl.java:39)
[sqlunit] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMet
hodAccessorImpl.java:25)
[sqlunit] at java.lang.reflect.Method.invoke(Method.java:324)
[sqlunit] at net.sourceforge.sqlunit.Assertions.invokeAssertion(Assertions
.java:775)
[sqlunit] ... 16 more
[sqlunit] Here is the message of the exception --MESSAGE SQLUnit Tests Failed:
In file: C:\dev\V4\test/com/sf/sfv4/db/procedure/firstproctest.xml, tests: 1, f
ailures: 1, errors = 0
[sqlunit] SQLUnit Tests Failed: In file: C:\dev\V4\test/com/sf/sfv4/db/procedu
re/firstproctest.xml, tests: 1, failures: 1, errors = 0
[sqlunit] net.sourceforge.sqlunit.SQLUnitException: SQLUnit Tests Failed: In f
ile: C:\dev\V4\test/com/sf/sfv4/db/procedure/firstproctest.xml, tests: 1, failur
es: 1, errors = 0
[sqlunit] at net.sourceforge.sqlunit.SQLUnit.testWrapper(SQLUnit.java:221)
[sqlunit] at net.sourceforge.sqlunit.SQLUnit.runTest(SQLUnit.java:195)
[sqlunit] at net.sourceforge.sqlunit.ant.SqlunitTask.execute(SqlunitTask.j
ava:110)
[sqlunit] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.ja
va:269)
[sqlunit] at org.apache.tools.ant.Task.perform(Task.java:364)
[sqlunit] at org.apache.tools.ant.Target.execute(Target.java:301)
[sqlunit] at org.apache.tools.ant.Target.performTasks(Target.java:328)
[sqlunit] at org.apache.tools.ant.Project.executeTarget(Project.java:1215)
[sqlunit] at org.apache.tools.ant.Project.executeTargets(Project.java:1063
)
[sqlunit] at org.apache.tools.ant.Main.runBuild(Main.java:632)
[sqlunit] at org.apache.tools.ant.Main.startAnt(Main.java:183)
[sqlunit] at org.apache.tools.ant.launch.Launcher.run(Launcher.java:197)
[sqlunit] at org.apache.tools.ant.launch.Launcher.main(Launcher.java:56)
[sqlunit] Caused by: net.sourceforge.sqlunit.SQLUnitException
[sqlunit] at net.sourceforge.sqlunit.Assertions.invokeAssertion(Assertions
.java:778)
[sqlunit] at net.sourceforge.sqlunit.Assertions.assertIsTrue(Assertions.ja
va:106)
[sqlunit] at net.sourceforge.sqlunit.handlers.TestHandler.process(TestHand
ler.java:191)
[sqlunit] at net.sourceforge.sqlunit.SQLUnit.processDoc(SQLUnit.java:299)
[sqlunit] at net.sourceforge.sqlunit.SQLUnit.testWrapper(SQLUnit.java:218)
[sqlunit] ... 12 more
[sqlunit] Caused by: java.lang.ClassCastException
[sqlunit] at net.sourceforge.sqlunit.Assertions.invokeAssertion(Assertions
.java:778)
[sqlunit] at net.sourceforge.sqlunit.Assertions.assertIsTrue(Assertions.ja
va:106)
[sqlunit] at net.sourceforge.sqlunit.Assertions.assertEqual(Assertions.jav
a:160)
[sqlunit] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[sqlunit] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcces
sorImpl.java:39)
[sqlunit] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMet
hodAccessorImpl.java:25)
[sqlunit] at java.lang.reflect.Method.invoke(Method.java:324)
[sqlunit] at net.sourceforge.sqlunit.Assertions.invokeAssertion(Assertions
.java:775)
[sqlunit] ... 16 more
[sqlunit] SQLUnit Tests Failed: In file: C:\dev\V4\test/com/sf/sfv4/db/procedu
re/firstproctest.xml, tests: 1, failures: 1, errors = 0
BUILD FAILED
C:\dev\V4\build.xml:1415: SQLUnit Tests Failed: In file: C:\dev\V4\test/com/sf/s
fv4/db/procedure/firstproctest.xml, tests: 1, failures: 1, errors = 0
Total time: 5 seconds
C:\dev\V4>
Hi Jojo,
I see this in the trace you sent me, looks like the stored procedure did not compile?
[sqlunit] DEBUG [main] (DatabaseResult.java:165) - >>
resetAsException(6550,ORA-06550: line 1, column 18:
[sqlunit] PLS-00103: Encountered the symbol "." when expecting one of the following:
[sqlunit] := . ( @ % ;
[sqlunit] The symbol ":= was inserted before "." to continue.
[sqlunit] )
I still have to look at the ClassCastException, not sure where thats coming from.
The correct behavior, imo, would be for it to say that you specified a result, but it got an exception. Also are you returning anything from the stored procedure? If its only the outparam you are interested in, you should specify an outparam in the result.
I will look at this some more this evening and let you know tomorrow.
-sujit
By taking the the extra dot "." from the procedure call eliminates the symbol problem. But there is still the ClassCastException(). Thanks for your help
Below is the modified statement.
-------------------------------------------
<call>
<stmt>{call USERDAO_PKG.getPasswordSP(?,?)}</stmt>
<param id="1" inout="in" type="VARCHAR">super</param>
<param id="2" inout="inout" type="VARCHAR">${OUT_PASSWORD}</param>
</call>
Hi Jojo,
I see where the ClassCastException was coming from, it was trying to cast a Throwable to an Exception in the InvocationTargetExeception catch block. This was because till 4.0, the SQLUnitException could be constructed only with an embedded Exception object, but since then, I have changed this to accept a Throwable. It sounds kind of dumb looking back on it now, but casting it down to an Exception was my way to get around that at the time. I have fixed that (removed the cast) and if you download from CVS and rebuild the JAR file, you should have no problems.
If you decide to rebuild the JAR file, remember to delete the sqlunit-4.0.jar file that you already have before running ant install. I should really make the build script tell you this instead of telling everybody this via email :-).
Now it should give you an exception, but it should be more related to the problem with the stored procedure and its results.
-sujit
thanks sujit, I will try it to see. I really appreciate your efforts.