@Test public void testGetNamedDateJobParameters() throws Exception { SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd"); Date date = dateFormat.parse(dateFormat.format(new Date())); StepExecution stepExecution = getStepExecution("foo(date)="+dateFormat.format(date)); extractor.setKeys(new String[] {"foo(date)"}); JobParameters jobParameters = extractor.getJobParameters(null, stepExecution); assertEquals("{foo="+date.getTime()+"}", jobParameters.toString()); }
@Test public void testGetNamedJobParameters() throws Exception { StepExecution stepExecution = getStepExecution("foo=bar"); extractor.setKeys(new String[] {"foo", "bar"}); JobParameters jobParameters = extractor.getJobParameters(null, stepExecution); assertEquals("{foo=bar}", jobParameters.toString()); }
@Test public void testGetNamedLongStringParameters() throws Exception { StepExecution stepExecution = getStepExecution("foo=bar"); extractor.setKeys(new String[] {"foo(string)", "bar"}); JobParameters jobParameters = extractor.getJobParameters(null, stepExecution); assertEquals("{foo=bar}", jobParameters.toString()); }
@Test public void testGetNamedLongJobParameters() throws Exception { StepExecution stepExecution = getStepExecution("foo(long)=11"); extractor.setKeys(new String[] {"foo(long)", "bar"}); JobParameters jobParameters = extractor.getJobParameters(null, stepExecution); assertEquals("{foo=11}", jobParameters.toString()); }
@Test public void testGetNamedIntJobParameters() throws Exception { StepExecution stepExecution = getStepExecution("foo(long)=11"); extractor.setKeys(new String[] {"foo(int)", "bar"}); JobParameters jobParameters = extractor.getJobParameters(null, stepExecution); assertEquals("{foo=11}", jobParameters.toString()); }
@Test public void testGetNamedDoubleJobParameters() throws Exception { StepExecution stepExecution = getStepExecution("foo(double)=11.1"); extractor.setKeys(new String[] {"foo(double)"}); JobParameters jobParameters = extractor.getJobParameters(null, stepExecution); assertEquals("{foo=11.1}", jobParameters.toString()); }
@Test public void testGetAllJobParameters() throws Exception { StepExecution stepExecution = getStepExecution("foo=bar,spam=bucket"); extractor.setKeys(new String[] {"foo", "bar"}); JobParameters jobParameters = extractor.getJobParameters(null, stepExecution); assertEquals("bar", jobParameters.getString("foo")); assertEquals("bucket", jobParameters.getString("spam")); }