@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); }
/** * SystemExiter를 설정한다. */ public static void presetSystemExiter(SystemExiter systemExiter) { EgovCommandLineRunner.systemExiter = systemExiter; }
/** * SystemExiter를 설정한다. */ public void setSystemExiter(SystemExiter systemExiter) { EgovCommandLineRunner.systemExiter = systemExiter; }
/** * 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; }
/** * Injection setter for the {@link SystemExiter}. * * @param systemExiter */ public void setSystemExiter(SystemExiter systemExiter) { CommandLineJobRunner.systemExiter = systemExiter; }