- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我是 Spring Batch 的新手,我有一个以下主程序,我想使用 jobLauncherTestUtils 将其转换为测试用例。我们怎样才能做到这一点?
我关注了http://docs.spring.io/spring-batch/reference/html/testing.html ,但我没有看到任何指针。请指导。
private void run() {
String[] springConfig = { "spring/batch/jobs/job-extract-users.xml" };
ApplicationContext context = new ClassPathXmlApplicationContext(springConfig);
JobLauncher jobLauncher = (JobLauncher) context.getBean("jobLauncher");
Job job = (Job) context.getBean("testActualJob");
try {
JobParameters param = new JobParametersBuilder().addString("age", "20").toJobParameters();
JobExecution execution = jobLauncher.run(job, param);
System.out.println("----------------------------------------------");
System.out.println("Exit Status : " + execution.getStatus());
System.out.println("Exit Status : " + execution.getAllFailureExceptions());
System.out.println("-----------------------------------------------");
} catch (Exception e) {
e.printStackTrace();
}
System.out.println("Done !!");
}
最佳答案
引自documentation :-
The launchJob() method is provided by the JobLauncherTestUtils class. Also provided by the utils class is launchJob(JobParameters), which allows the test to give particular parameters.
您的代码如下所示:-
JobParameters param = new JobParametersBuilder().addString("age", "20").toJobParameters();
JobExecution jobExecution = jobLauncherTestUtils.launchJob(param).getStatus();
关于java - 如何将 JobParameters 传递给 Spring Batch Junit 测试用例 JobLauncherTestUtils?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41804389/
我最近购买了《C 编程语言》并尝试了 Ex 1-8这是代码 #include #include #include /* * */ int main() { int nl,nt,nb;
早上好!我有一个变量“var”,可能为 0。我检查该变量是否为空,如果不是,我将该变量保存在 php session 中,然后调用另一个页面。在这个新页面中,我检查我创建的 session 是否为空,
我正在努力完成 Learn Python the Hard Way ex.25,但我无法理解某些事情。这是脚本: def break_words(stuff): """this functio
我是一名优秀的程序员,十分优秀!