Java 类org.springframework.batch.core.launch.support.SystemExiter 实例源码

项目:spring-batch-experiments    文件:CommandLineJobRunnterTest.java   
@Test
public void run() throws Exception {

    final Queue<Integer> exitCode = new ArrayBlockingQueue<Integer>(1);
    CommandLineJobRunner.presetSystemExiter(new SystemExiter() {
        @Override
        public void exit(int status) {
            exitCode.add(status);
        }
    });

    CommandLineJobRunner.main(new String[]{
        JOB_CONTEXT,
        "importProductsJob"
    });
    assertThat(exitCode.poll().intValue()).isEqualTo(0);

    CommandLineJobRunner.main(new String[]{
        JOB_CONTEXT,
        "importProductsJob",
        "exit.status=COMPLETED"
    });
    assertThat(exitCode.poll().intValue()).isEqualTo(0);

    CommandLineJobRunner.main(new String[]{
        JOB_CONTEXT,
        "importProductsJob",
        "exit.status=FAILED"
    });
    assertThat(exitCode.poll().intValue()).isEqualTo(1);

    CommandLineJobRunner.main(new String[]{
        JOB_CONTEXT,
        "importProductsJob",
        "exit.status=COMPLETED WITH SKIPS"
    });
    assertThat(exitCode.poll().intValue()).isEqualTo(3);

    CommandLineJobRunner.main(new String[]{
        JOB_CONTEXT,
        "importProductsJob",
        "exit.status=ANYTHING"
    });
    assertThat(exitCode.poll().intValue()).isEqualTo(2);
}
项目:egovframework.rte.root    文件:EgovCommandLineRunner.java   
/**
 * SystemExiter를 설정한다.
 */
public static void presetSystemExiter(SystemExiter systemExiter) {
    EgovCommandLineRunner.systemExiter = systemExiter;
}
项目:egovframework.rte.root    文件:EgovCommandLineRunner.java   
/**
 * SystemExiter를 설정한다.
 */
public void setSystemExiter(SystemExiter systemExiter) {
    EgovCommandLineRunner.systemExiter = systemExiter;
}
项目:marklogic-spring-batch    文件:CommandLineJobRunner.java   
/**
 * Static setter for the {@link SystemExiter} so it can be adjusted before
 * dependency injection. Typically overridden by
 * {@link #setSystemExiter(SystemExiter)}.
 *
 * @param systemExiter
 */
public static void presetSystemExiter(SystemExiter systemExiter) {
    CommandLineJobRunner.systemExiter = systemExiter;
}
项目:marklogic-spring-batch    文件:CommandLineJobRunner.java   
/**
 * Injection setter for the {@link SystemExiter}.
 *
 * @param systemExiter
 */
public void setSystemExiter(SystemExiter systemExiter) {
    CommandLineJobRunner.systemExiter = systemExiter;
}