背景:
我正在使用selenium-server-2.25.0与J-Unit 4一起为我的GWT应用程序运行一些UI测试场景.在我的IDE(Netbeans 7.2)中,我可以右键单击我的项目,选择"Test",然后看到Firefox窗口全部弹出(因为它们应该),Selenium测试按预期运行.从命令行,我也可以运行mvn integration-test并查看相同的内容.
目标:
我正在尝试让这些测试在Xvfb显示器中无头运行,但我似乎无法将其与Maven一起使用.我可以export display=:2事先手动运行(:2是我的Xvfb显示),然后测试然后DO在隐形显示中成功运行.
问题:
似乎没有任何改变都当我包括完整的<plugin>从入门这里在我的pom.xml和运行mvn integration-test.我仍然看到Windows全部弹出,测试运行不在 Xvfb显示器中.如果我把它取出并再次运行,结果相同.当我从改变相位pre-integration-test,以qwertyasdf然而,Maven的并不抱怨无效的生命周期阶段-所以我知道它不是完全无视它,我编辑相应的pom.xml.
谢谢!
Is there an easy way to detect whether JAI's native binaries are installed?
JAI (Java Advanced Imaging) can run in multiple modes both with and without the native binaries that make it process images faster and also add support for additional formats. But, as the native libraries cannot be installed with Maven, how can you detect whether they're installed in the system?
我的要求是我想执行数据库操作.所以,我在做......
Public boolean myFunction(){
Session session = sessionFactory.getCurrentSession();
if(session!=null){
if (tx != null) {
Transaction tx = session.beginTransaction();
//Perform database operation...
tx.rollback();
if (session.isOpen()) {
session.close();
}
tx = null;
session = null;
}
}else{
return;
}
}
Run Code Online (Sandbox Code Playgroud)
当我的会话不包含任何先前未提及/展开的tranasction时,这很有效.
现在,问题Sceanario就在这里......
Sceanario:
有一个服务...调用myFunction(),该服务在会话中已有一个活动事务.
问题:当myfunction()执行tx.rollback()时...它还回滚了父进程的事务.
1.) Why this happen???
2.) Is there nay way to determine... weather hibernate session contains any previous open/uncommited/active/unrolledback/continue transaction?
Run Code Online (Sandbox Code Playgroud)
我试过了...
Public boolean myFunction(){
Session session = sessionFactory.getCurrentSession();
if(session!=null){
if (tx != null) {
boolean isAlreadyTransactionStarted = sessionFactory.getCurrentSession().getTransaction().isActive(); …Run Code Online (Sandbox Code Playgroud) 问题:我们如何使用包含数字和非数字字段的原始lucene查询字符串提供hibernate搜索?
背景:我们最近升级到HibernateSearch 5.0,由于HibernateSearch Query Parser(pre-lucene)发生了更改,我们的许多查询现在都失败了,并出现以下错误:
The specified query contains a string based sub query which targets the numeric encoded field(s)
在大多数情况下,MultiFieldQueryParser由于我们运行的查询的复杂性,我们使用lucene的文本语法和a 将查询传递给HibernateSearch.直到HibernateSearch 5.0,这些都运行良好.在升级中,我们遇到了从HibernateSearch抛出的异常,这些异常阻止我们的应用程序运行以前的查询.我们不明白为什么抛出异常或者是向前推进的最佳方式.
在试图追踪问题时,我试图简化哪些有效,哪些无法以最原始的形式进行.(这是由HibernateSearch的QueryValidationTest构建的).
例子:
给定以下Entity类:
@Entity
@Indexed
public static class B {
@Id
@GeneratedValue
private long id;
@Field
private long value;
@Field
private String text;
}
Run Code Online (Sandbox Code Playgroud)
测试1(我们如何为hibernate搜索编写查询:FAILURE):
QueryParser parser = new MultiFieldQueryParser(new String[]{"id","value","num"},new StandardAnalyzer());
Query query = parser.parse("+(value:1 text:test)");
FullTextQuery fullTextQuery = fullTextSession.createFullTextQuery( query, B.class );
fullTextQuery.list();
Run Code Online (Sandbox Code Playgroud)
结果是:
org.hibernate.search.exception.SearchException: HSEARCH000233: The specified query …Run Code Online (Sandbox Code Playgroud) 我一直在尝试使用我们现有的Spring 进行测试@TransactionalEvents(Spring 4.2的功能https://spring.io/blog/2015/02/11/better-application-events-in-spring-framework-4-2) JUnit测试(通过@TransactionalTestExecutionListener或子类运行AbstractTransactionalUnit4SpringContextTests,但是似乎有一个强制选择-运行没有@Rollback注释的测试,或者事件不触发。有没有人遇到测试@TransactionalEvents的好方法,同时能够@回滚测试?