如何配置Netbeans以调用Maven Failsafe来运行特定的集成测试?
我知道执行此操作的Maven命令是'mvn -Dit.test = MyClassIT verify'我也知道如何在Netbeans Project属性中配置'actions'.
我的问题是:
使用Netbeans 7.1和Netbeans Dev 201201260600
我需要在低优先级下启动CPU密集型系统进程,这样它不会减慢我的服务器速度.我怎么能在Linux上这样做?
这与此问题类似:使用Runtime.exec/ProcessBuilder.start以低优先级启动Java进程?除了Linux而不是Windows.如果在进程启动后更改进程的优先级(只要没有太多延迟),则可以.
配置Logback的大多数示例都使用logback.xml.但是,我的应用程序使用配置文件的 Spring功能和PropertySourcesPlaceholderConfigurer将特定于环境的配置注入需要它的组件中.像我的其他Spring组件一样,以编程方式配置Logback的正确方法是什么?
在 Spring 3.1 中,如果我包含以下 BeanFactoryPostProcessor,我可以将具有 `@Scope("request") 的 Jax-RS 资源自动装配到我的单元测试中:
@Component
public class MockRequestBeanFactoryPostProcessor implements BeanFactoryPostProcessor {
public void postProcessBeanFactory(
ConfigurableListableBeanFactory beanFactory) throws BeansException {
beanFactory.registerScope("request", new RequestScope());
MockHttpServletRequest request = new MockHttpServletRequest();
ServletRequestAttributes attributes = new ServletRequestAttributes(request);
RequestContextHolder.setRequestAttributes(attributes);
}
Run Code Online (Sandbox Code Playgroud)
}
在 Spring 3.2 中,第一个运行的测试方法有效,但所有后续的测试方法都得到
java.lang.IllegalStateException: No thread-bound request found: 您是指实际 Web 请求之外的请求属性,还是在原始接收线程之外处理请求?如果您实际上是在 Web 请求中操作并且仍然收到此消息,则您的代码可能在 DispatcherServlet/DispatcherPortlet 之外运行:在这种情况下,请使用 RequestContextListener 或 RequestContextFilter 来公开当前请求。
我怎样才能让我的测试重新工作?