Unitils

2018.5.3 maven

丶灬走出姿态 提交于 2020-05-02 16:53:38
1 maven基本概念 1.1maven是什么 1)软件项目管理和理解工具 2)项目对象模型(Project Object Model,POM) 3)项目的构建、报告和文档的中心信息 1.2maven仓库 1.3 pom.xml a)groupId:项目或者组织的唯一标志 b)artifactId: 项目的通用名称 c)version:项目的版本 d)packaging: 打包的机制,如pom, jar, maven-plugin, ejb, war, ear, rar 1.4 lifecycle validate generate-sources process-sources generate-resources process-resources 复制并处理资源文件,至目标目录,准备打包。 compile 编译项目的源代码。 process-classes generate-test-sources process-test-sources generate-test-resources process-test-resources 复制并处理资源文件,至目标测试目录。 test-compile 编译测试源代码。 process-test-classes test 使用合适的单元测试框架运行测试。这些测试代码不会被打包或部署。 prepare-package package

Unitils doesn't work

…衆ロ難τιáo~ 提交于 2020-01-24 20:20:47
问题 I have a big problem my unitils.properties: database.driverClassName=com.mysql.jdbc.Driver database.url=jdbc:mysql://localhost/timesheet_test database.userName=root database.password= database.schemaNames=timesheet_test database.dialect=mysql updateDataBaseSchema.enabled=true dbMaintainer.script.locations=src/test/resources/dbscripts dataSetStructureGenerator.xsd.dirName=target/xsd dbMaintainer.autoCreateExecutedScriptsTable=true dbMaintainer.disableConstraints.enabled=false ## Módulos do

EasyMock deep stubs

故事扮演 提交于 2020-01-24 17:14:28
问题 I have to mock the following security step using EasyMock or UnitilsMock. Could you please suggest a way to achieve this? String id = context.getCallerPrincipal().getName(); This step is related to security. So I will not be able to create a Principle object and make a two tier mocking. I know that mockito handles such stuff easily as follows, @Mock(answer = Answers.RETURNS_DEEP_STUBS) SessionContext mockContext; But, I need a similar solution using EasyMock or Unitils Mock. The complete code

Unitils: How can it obtain database properties from Spring

送分小仙女□ 提交于 2019-12-24 10:25:55
问题 I am using Unitils with Spring for unit testing. I've configured Spring with datasource using a properties file. My question is how can I use the same datasource or the same properties for Unitils? Unitils expects a file in the classpath unitils.properties with database configuration parameters like url, user, password and driver. I've tried to configure Unitils using the properties used in the Spring configuration as below but it is not working. database.driverClassName=${jdbc.driver.class}

Unitils database exception

夙愿已清 提交于 2019-12-12 03:23:16
问题 In my project I am using JDBC, MySQL, Servlets, JSP. To test my dao's i made some unit tests and i am trying to use JUnit and Unitils. I am getting this exception: org.unitils.core.UnitilsException: Error inserting test data from DbUnit dataset for method public void com.jean.taxi.daoImpl.ClientDaoImplTest.testListModerators() at org.unitils.dbunit.DbUnitModule.insertDataSet(DbUnitModule.java:190) at org.unitils.dbunit.DbUnitModule$DbUnitListener.beforeTestSetUp(DbUnitModule.java:791) at org

Evicted object still issues updates to the database in Hibernate

 ̄綄美尐妖づ 提交于 2019-12-11 03:45:12
问题 I have a problem where I evict an entity, but changes made to it will still change the database. This is part of the method in my DAO. @Entity public class Profile { @Id @GeneratedValue private Long id; @OneToMany(cascade = CascadeType.ALL) @JoinColumn(name = "PROFILE_ID") @LazyCollection(LazyCollectionOption.FALSE) private List<Avatar> avatars; ... } In a DAO method: Profile profile = getProfile(...); // Clear from hibernate currentSession.evict(profile); profile.setId(null); for (Avatar a :

Ignoring case in strings with unitils ReflectionComparator

我与影子孤独终老i 提交于 2019-12-11 03:32:41
问题 I'm using unitils tool for deep objects comparing, via ReflectionComparator : ReflectionComparatorMode[] modes = {ReflectionComparatorMode.LENIENT_ORDER, ReflectionComparatorMode.IGNORE_DEFAULTS}; ReflectionComparator comparator = ReflectionComparatorFactory.createRefectionComparator(modes); Difference difference = comparator.getDifference(oldObject, newObject); It turns out that this ReflectionComparator doesn't ignore case in String fields values. And there isn't sprecial mode for this

spring3,unitils 与dbunit整合问题记录

落花浮王杯 提交于 2019-12-03 12:47:03
unitils 3.3版本,spring3.2.4 1.Caused by: java.lang.IllegalStateException: org.slf4j.LoggerFactory could not be successfully initialized. See also http://www.slf4j.org/codes.html#unsuccessfulInit SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Found binding in [jar:file:/E:/user/.m2/repository/org/slf4j/slf4j-nop/1.4.3/slf4j-nop-1.4.3.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: Found binding in [jar:file:/E:/user/.m2/repository/org/slf4j/slf4j-log4j12/1.7.5/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: See http://www.slf4j.org/codes.html#multiple

Using unitils/dbMaintain to maintain database, how to exclude scripts from being run?

那年仲夏 提交于 2019-12-02 07:58:42
I am using unitils (and its dbMaintain module) to maintain the state of my local database. dbMaintain has an option to exclude/include scripts based on a qualifier. See http://www.dbmaintain.org/tutorial.html#Qualifier_inclusion__exclusion . In my project, excludes/includes do not work when running from a Unitils test with the UnitilsJUnit4TestClassRunner . My script hierarchy: unitils/ 01_create/ <lots of scripts here> 02_lkups/ <lots of scripts here> 03_#testdata/01_#testdata_master/05_#testdata_master_rate_offer.sql My unitils.properties file has: updateDataBaseSchema.enabled=true

Is Unitils project alive?

社会主义新天地 提交于 2019-11-29 08:31:47
anybody knows whether unitils project is still alive. On there pages last version is 3.3 in maven repository it is 3.4.2.(Actually there is google cached version of their pages where the version is said to be 3.4.2) Anyway is there any replacement for this project. I kind of lack the vivid community around and really don't want to be bound to dying project. Unitils seems to be almost abandoned nowadays. Project is available on the GitHub here and you can look at its history and activity. Anyways my two cents... Unitils has serious drawbacks: Integrates many third-party libs (easymock, dbunit,