emacarron / mybatis

Automatically exported from code.google.com/p/mybatis
0 stars 0 forks source link

mybatis-spring junit tests #99

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
This zip file contains junit tests for the spring-mybatis subproject.
The spring-mybatis source is under /src/main/java (unaltered from download) and 
the test classes are under /src/test/java

Original issue reported on code.google.com by r...@velocitylabs.com on 12 Sep 2010 at 10:19

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by simone.t...@gmail.com on 13 Sep 2010 at 4:32

GoogleCodeExporter commented 9 years ago
Did you run the tests before submitting the zip? Once downloaded and runned 
into Maven, I got this message:

----
-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running org.mybatis.spring.FlavourTest
log4j:WARN No appenders could be found for logger 
(org.springframework.context.annotation.AnnotationConfigApplicationContext).
log4j:WARN Please initialize the log4j system properly.
Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 1.078 sec <<< 
FAILURE!
Running org.mybatis.spring.WaterTest
Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 0.006 sec <<< 
FAILURE!
Running org.mybatis.spring.SpringEnabledTest
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.007 sec <<< 
FAILURE!

Results :

Tests in error: 
  org.mybatis.spring.FlavourTest
  org.mybatis.spring.FlavourTest
  org.mybatis.spring.WaterTest
  org.mybatis.spring.WaterTest
  initializationError(org.mybatis.spring.SpringEnabledTest)

Tests run: 5, Failures: 0, Errors: 5, Skipped: 0

[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
----

Moreover, it seems HSQL doesn't support the generated-keys auto-retrieving, so 
you can't use the

----
useGeneratedKeys="true" keyProperty="XXX"
----

in the XML Mappers...

Any idea?

Original comment by simone.t...@gmail.com on 14 Sep 2010 at 12:50

GoogleCodeExporter commented 9 years ago
Resolved using

---
<insert id="create" parameterType="Flavour">
        insert into
            flavour(
                name
            )
        values (
            #{name}
        )
        <selectKey order="AFTER" resultType="int" keyProperty="id">
            CALL IDENTITY()
        </selectKey>
    </insert>
---

but still having problems with selects that return no data even if just 
inserted.
I need more investigations...

Original comment by simone.t...@gmail.com on 14 Sep 2010 at 3:27

GoogleCodeExporter commented 9 years ago
Patch has been successfully applied, you can see it on r2331.
We had to modify your code due to previous problems, btw all is well what ends 
well ;)
Thanks for the contribution!

Original comment by simone.t...@gmail.com on 14 Sep 2010 at 5:19

GoogleCodeExporter commented 9 years ago
Yes it worked perfectly fine for me - under both MySql and HSQL. I initially 
had some problems with the HSQL port as you would have seen in the mailing list 
but I resolved these all. My HSQL version is 2.0.0

Original comment by r...@velocitylabs.com on 15 Sep 2010 at 9:11

GoogleCodeExporter commented 9 years ago
I think you run them only under your IDE. The 
org.mybatis.spring.SpringEnabledTest (that doesn't exist anymore) wasn't 
declaring any test method and not being Abstract it was take from Surefire as 
test class, and obviously failed; JUnit4 requires at least 1 test method for 
each test class.
BTW check your patch out to see how it was integrated in the project, you've 
been mentioned in the contributors in the pom.xml, enjoy!

Original comment by simone.t...@gmail.com on 15 Sep 2010 at 9:17

GoogleCodeExporter commented 9 years ago

Original comment by eduardo.macarron on 1 Jan 2011 at 5:27