BATCH-219 and BATCH-330: Created ExecutionAttributes, which are stored in the table BATCH_STEP_EXECUTION_ATTRIBUTES.

This commit is contained in:
lucasward
2008-02-05 02:32:58 +00:00
parent 625480382c
commit 96a11b3bb7
7 changed files with 24 additions and 21 deletions

View File

@@ -17,7 +17,7 @@ package org.springframework.batch.core.domain;
import junit.framework.TestCase;
import org.springframework.batch.item.StreamContext;
import org.springframework.batch.item.ExecutionAttributes;
/**
* @author Dave Syer
@@ -41,11 +41,11 @@ public class StepContributionTests extends TestCase {
/**
* Test method for
* {@link org.springframework.batch.core.domain.StepContribution#setStreamContext(StreamContext)}.
* {@link org.springframework.batch.core.domain.StepContribution#setStreamContext(ExecutionAttributes)}.
*/
public void testSetStreamContext() {
assertEquals(null, contribution.getStreamContext());
StreamContext context = new StreamContext();
ExecutionAttributes context = new ExecutionAttributes();
context.putString("foo", "bar");
contribution.setStreamContext(context);
assertEquals(1, contribution.getStreamContext().getProperties().size());

View File

@@ -19,7 +19,7 @@ import java.util.Date;
import junit.framework.TestCase;
import org.springframework.batch.item.StreamContext;
import org.springframework.batch.item.ExecutionAttributes;
import org.springframework.batch.repeat.ExitStatus;
/**
@@ -200,7 +200,7 @@ public class StepExecutionTests extends TestCase {
public void testStreamContext() throws Exception {
assertNotNull(execution.getStreamContext());
StreamContext context = new StreamContext();
ExecutionAttributes context = new ExecutionAttributes();
context.putString("foo", "bar");
execution.setStreamContext(context );
assertEquals("bar", execution.getStreamContext().getString("foo"));

View File

@@ -17,6 +17,7 @@ package org.springframework.batch.core.domain;
import junit.framework.TestCase;
import org.springframework.batch.item.ExecutionAttributes;
import org.springframework.batch.item.StreamContext;
import org.springframework.batch.support.PropertiesConverter;
@@ -50,7 +51,9 @@ public class StepInstanceTests extends TestCase {
public void testGetStreamContext() {
assertNotNull(instance.getStreamContext());
assertTrue(instance.getStreamContext().getProperties().isEmpty());
instance.setStreamContext(new StreamContext(PropertiesConverter.stringToProperties("foo=bar")));
ExecutionAttributes executionAttributes = new ExecutionAttributes();
executionAttributes.putString("foo", "bar");
instance.setStreamContext(executionAttributes);
assertEquals("bar", instance.getStreamContext().getProperties().getProperty("foo"));
}