@Override protected void pointReaderToOutput(ItemReader<CustomerCredit> reader) { JobParameters jobParameters = new JobParametersBuilder(super.getUniqueJobParameters()) .addString("input.file.path", "file:build/test-outputs/multiResourceOutput.csv.*") .toJobParameters(); StepExecution stepExecution = MetaDataInstanceFactory.createStepExecution(jobParameters); StepSynchronizationManager.close(); StepSynchronizationManager.register(stepExecution); }
/** * @param testContext the current test context * @throws Exception if there is a problem * @see TestExecutionListener#afterTestMethod(TestContext) */ @Override public void afterTestMethod(TestContext testContext) throws Exception { Method method = TestContext.class.getMethod(HAS_ATTRIBUTE_METHOD_NAME, String.class); Boolean hasAttribute = (Boolean) ReflectionUtils.invokeMethod(method, testContext, STEP_EXECUTION); if (hasAttribute) { StepSynchronizationManager.close(); } }
/** * @param testContext the current test context * @throws Exception if there is a problem * @see TestExecutionListener#beforeTestMethod(TestContext) */ @Override public void beforeTestMethod(TestContext testContext) throws Exception { Method hasAttributeMethod = TestContext.class.getMethod(HAS_ATTRIBUTE_METHOD_NAME, String.class); Boolean hasAttribute = (Boolean) ReflectionUtils.invokeMethod(hasAttributeMethod, testContext, STEP_EXECUTION); if (hasAttribute) { Method method = TestContext.class.getMethod(GET_ATTRIBUTE_METHOD_NAME, String.class); StepExecution stepExecution = (StepExecution) ReflectionUtils.invokeMethod(method, testContext, STEP_EXECUTION); StepSynchronizationManager.register(stepExecution); } }
@Before public void before() { StepSynchronizationManager.release(); StepSynchronizationManager.close(); }