google-code-export / nutz

Automatically exported from code.google.com/p/nutz
Apache License 2.0
1 stars 1 forks source link

BoneCP+H2运行Nutz 的junit失败 #360

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
问题产生的条件:
bonecp+h2
发生问题的调用代码:

问题的详细说明:
DBCP+H2没有这个问题。
单纯的H2也没有问题。
不管H2是file还是men方式一样出问题。
单独测试没有问题。
Failed tests: 
  test_in_classpath(org.nutz.resource.ScansTest)
  test_in_jar(org.nutz.resource.ScansTest)
  test_classes_in_jar(org.nutz.resource.ScansTest)
  test_classes_in_package_path(org.nutz.resource.ScansTest)
  test_in_classpath(org.nutz.resource.ScansTest)
  test_in_jar(org.nutz.resource.ScansTest)
  test_classes_in_jar(org.nutz.resource.ScansTest)
  test_classes_in_package_path(org.nutz.resource.ScansTest)

Tests in error: 
  run_2_sqls_with_error(org.nutz.dao.test.normal.SimpleDaoTest)
  test_clear_two_records(org.nutz.dao.test.normal.SimpleDaoTest)
  test_delete_records(org.nutz.dao.test.normal.SimpleDaoTest)
  test_integer_object_column(org.nutz.dao.test.normal.SimpleDaoTest)
  query_by_special_char(org.nutz.dao.test.normal.QueryTest)
  query_by_special_char2(org.nutz.dao.test.normal.QueryTest)
  query_by_pager(org.nutz.dao.test.normal.QueryTest)
  fetch_by_name(org.nutz.dao.test.normal.QueryTest)
  query_records(org.nutz.dao.test.normal.QueryTest)
  run_2_sqls_with_error(org.nutz.dao.test.normal.SimpleDaoTest)
  test_clear_two_records(org.nutz.dao.test.normal.SimpleDaoTest)
  test_delete_records(org.nutz.dao.test.normal.SimpleDaoTest)
  test_integer_object_column(org.nutz.dao.test.normal.SimpleDaoTest)
  test_override_field(org.nutz.dao.test.entity.EntityParsingTest)

异常堆栈:

相关日志:

Original issue reported on code.google.com by sjbwy...@gmail.com on 20 Jan 2011 at 10:56

Attachments:

GoogleCodeExporter commented 9 years ago
Failed tests: 
  test_in_classpath(org.nutz.resource.ScansTest)
  test_in_jar(org.nutz.resource.ScansTest)
  test_classes_in_jar(org.nutz.resource.ScansTest)
  test_classes_in_package_path(org.nutz.resource.ScansTest)
  test_in_classpath(org.nutz.resource.ScansTest)
  test_in_jar(org.nutz.resource.ScansTest)
  test_classes_in_jar(org.nutz.resource.ScansTest)
  test_classes_in_package_path(org.nutz.resource.ScansTest)
这些是Scans的问题.

Original comment by wendal1985@gmail.com on 20 Jan 2011 at 10:57

GoogleCodeExporter commented 9 years ago
单独运行AllNormal测试,pass
按AllMapping --> AllNormal顺序执行, fail
按AllNormal --> AllMapping 顺序执行, pass

只执行 AllMapping中的DynamicManyManyTest ,然后继续执行AllNormal   
fail

将语句: pojos.init();  加入SimpleDaoTest的before方法的第一行, 
可以将fail的个数减至1

Original comment by wendal1985@gmail.com on 20 Jan 2011 at 11:31

GoogleCodeExporter commented 9 years ago
不知到 BoneCP + Mysql 有没有这个问题

Original comment by zozoh...@gmail.com on 20 Jan 2011 at 3:25

GoogleCodeExporter commented 9 years ago
应该没有,我在使用呢。今天找个时间试试。
就是,如果将Nutzs类的获取Ioc的方法改为:
    public static Ioc getIoc(String key) {
        return new NutIoc(new JsonLoader(key));
    }
即每个获取Ioc实例都是新建的,就会是之前的fail的测试全部p
ass

故,应该是多个测试共有同一个数据源导致的。

Original comment by wendal1985@gmail.com on 21 Jan 2011 at 12:18

GoogleCodeExporter commented 9 years ago
换成这种方式的时候,其他的又有问题了。

Original comment by sjbwy...@gmail.com on 21 Jan 2011 at 2:17

Attachments:

GoogleCodeExporter commented 9 years ago
添加了测试用例 BoneCP_Test 能够重现这个问题

Original comment by wendal1985@gmail.com on 26 Jan 2011 at 1:02

GoogleCodeExporter commented 9 years ago
的确,单独运行也是出 

org.nutz.dao.DaoException: !Nutz SQL Error: 'SELECT COUNT(*) FROM t_pet '
PreparedStatement: 
'SELECT COUNT(*) FROM t_pet '
    at org.nutz.dao.sql.SqlImpl.execute(SqlImpl.java:127)
    at org.nutz.dao.impl.DefaultDaoExecutor$1.invoke(DefaultDaoExecutor.java:33)
    at org.nutz.dao.ConnectionHolder.invoke(ConnectionHolder.java:43)
    at org.nutz.dao.impl.DefaultDaoRunner.run(DefaultDaoRunner.java:21)
    at org.nutz.dao.impl.DefaultDaoExecutor.execute(DefaultDaoExecutor.java:20)
    at org.nutz.dao.impl.NutDao.execute(NutDao.java:233)
    at org.nutz.dao.impl.NutDao.count(NutDao.java:254)
    at org.nutz.dao.impl.NutDao.count(NutDao.java:246)
    at org.nutz.dao.test.normal.BoneCP_Test.clear_links(BoneCP_Test.java:34)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
    at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: org.h2.jdbc.JdbcSQLException: Timeout trying to lock table "T_PET"; 
SQL statement:
SELECT COUNT(*) FROM t_pet  [50200-125]
    at org.h2.message.Message.getSQLException(Message.java:111)
    at org.h2.message.Message.getSQLException(Message.java:122)
    at org.h2.message.Message.getSQLException(Message.java:75)
    at org.h2.table.TableData.doLock(TableData.java:495)
    at org.h2.table.TableData.lock(TableData.java:433)
    at org.h2.table.TableFilter.lock(TableFilter.java:119)
    at org.h2.command.dml.Select.queryWithoutCache(Select.java:546)
    at org.h2.command.dml.Query.query(Query.java:243)
    at org.h2.command.CommandContainer.query(CommandContainer.java:81)
    at org.h2.command.Command.executeQuery(Command.java:133)
    at org.h2.jdbc.JdbcPreparedStatement.executeQuery(JdbcPreparedStatement.java:98)
    at com.jolbox.bonecp.PreparedStatementHandle.executeQuery(PreparedStatementHandle.java:197)
    at org.nutz.dao.sql.SqlImpl.execute(SqlImpl.java:75)
    ... 32 more

Original comment by zozoh...@gmail.com on 26 Jan 2011 at 1:56

GoogleCodeExporter commented 9 years ago
提交了 r1788
在 pojo.js 
里增加了一段注释的配置,当把注释取消后,就能重现这个 
bug

Original comment by zozoh...@gmail.com on 26 Jan 2011 at 1:59

GoogleCodeExporter commented 9 years ago
https://bugs.launchpad.net/bugs/721739

0.7.1rc4没有这个问题.

Original comment by wendal1985@gmail.com on 21 Feb 2011 at 12:17

GoogleCodeExporter commented 9 years ago
加了一个标注,1.b.36 发布前再测测,没问题就可以 fix 
了,哈

Original comment by zozoh...@gmail.com on 21 Feb 2011 at 12:37

GoogleCodeExporter commented 9 years ago

Original comment by zozoh...@gmail.com on 24 Mar 2011 at 4:19

GoogleCodeExporter commented 9 years ago

Original comment by zozoh...@gmail.com on 24 Mar 2011 at 4:21