diff --git a/samples/.springBeans b/samples/.springBeans index 5384a5417..a237b3bdb 100644 --- a/samples/.springBeans +++ b/samples/.springBeans @@ -20,23 +20,8 @@ src/main/resources/jobs/adhocLoopJob.xml src/main/resources/jobs/infiniteLoopJob.xml src/main/resources/data-source-context-init.xml - src/main/resources/jobs/compositeProcessorSample.xml - - - true - false - - /execution/src/test/resources/simple-container-definition.xml - src/main/resources/data-source-context.xml - src/main/resources/data-source-context-init.xml - src/main/resources/jobs/multilineOrderInputDescriptors.xml - src/main/resources/jobs/multilineOrderIo.xml - src/main/resources/jobs/multilineOrderJob.xml - src/main/resources/jobs/multilineOrderOutputDescriptors.xml - - true @@ -131,11 +116,24 @@ true false - src/main/resources/jobs/compositeProcessorSample.xml src/main/resources/simple-container-definition.xml src/main/resources/data-source-context.xml src/main/resources/data-source-context-init.xml + + + true + false + + src/main/resources/data-source-context.xml + src/main/resources/data-source-context-init.xml + src/main/resources/jobs/multilineOrderInputDescriptors.xml + src/main/resources/jobs/multilineOrderIo.xml + src/main/resources/jobs/multilineOrderJob.xml + src/main/resources/jobs/multilineOrderOutputDescriptors.xml + src/main/resources/simple-container-definition.xml + + diff --git a/samples/jobLauncher.launch b/samples/jobLauncher.launch new file mode 100644 index 000000000..8dbf40f5b --- /dev/null +++ b/samples/jobLauncher.launch @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/samples/src/main/java/org/springframework/batch/sample/dao/FlatFileOrderWriter.java b/samples/src/main/java/org/springframework/batch/sample/dao/FlatFileOrderWriter.java index 7ff3bf5d6..a1bcb3a22 100644 --- a/samples/src/main/java/org/springframework/batch/sample/dao/FlatFileOrderWriter.java +++ b/samples/src/main/java/org/springframework/batch/sample/dao/FlatFileOrderWriter.java @@ -29,7 +29,7 @@ import org.springframework.beans.factory.DisposableBean; * * @author Dave Syer */ -public class FlatFileOrderWriter implements OrderWriter, DisposableBean { +public class FlatFileOrderWriter implements OrderWriter { /** * Takes care of writing to a file */ @@ -56,24 +56,6 @@ public class FlatFileOrderWriter implements OrderWriter, DisposableBean { outputSource.write(converter.convert(data)); } - public void open() { - outputSource.open(); - } - - public void close() { - outputSource.close(); - } - - /** - * Calls close to ensure that bean factories can close and always release - * resources. - * - * @see org.springframework.beans.factory.DisposableBean#destroy() - */ - public void destroy() throws Exception { - close(); - } - public void setOutputSource(OutputSource outputSource) { this.outputSource = outputSource; } diff --git a/samples/src/main/java/org/springframework/batch/sample/dao/OrderWriter.java b/samples/src/main/java/org/springframework/batch/sample/dao/OrderWriter.java index df2594527..ba063f083 100644 --- a/samples/src/main/java/org/springframework/batch/sample/dao/OrderWriter.java +++ b/samples/src/main/java/org/springframework/batch/sample/dao/OrderWriter.java @@ -16,13 +16,12 @@ package org.springframework.batch.sample.dao; -import org.springframework.batch.item.ResourceLifecycle; import org.springframework.batch.sample.domain.Order; /** * Interface for writing Order objects. */ -public interface OrderWriter extends ResourceLifecycle { +public interface OrderWriter { public void write(Order order); diff --git a/samples/src/main/resources/jobs/beanWrapperMapperSampleJob.xml b/samples/src/main/resources/jobs/beanWrapperMapperSampleJob.xml index 952e3caa7..31541e686 100644 --- a/samples/src/main/resources/jobs/beanWrapperMapperSampleJob.xml +++ b/samples/src/main/resources/jobs/beanWrapperMapperSampleJob.xml @@ -11,7 +11,7 @@ - + @@ -132,4 +132,9 @@ + + + + + diff --git a/samples/src/main/resources/jobs/compositeProcessorSample.xml b/samples/src/main/resources/jobs/compositeProcessorSampleJob.xml similarity index 93% rename from samples/src/main/resources/jobs/compositeProcessorSample.xml rename to samples/src/main/resources/jobs/compositeProcessorSampleJob.xml index 0e8c04a66..c24e73a16 100644 --- a/samples/src/main/resources/jobs/compositeProcessorSample.xml +++ b/samples/src/main/resources/jobs/compositeProcessorSampleJob.xml @@ -12,7 +12,6 @@ - @@ -100,4 +99,9 @@ + + + + + \ No newline at end of file diff --git a/samples/src/main/resources/jobs/fixedLengthImportJob.xml b/samples/src/main/resources/jobs/fixedLengthImportJob.xml index 9609029c4..3f61c9b67 100644 --- a/samples/src/main/resources/jobs/fixedLengthImportJob.xml +++ b/samples/src/main/resources/jobs/fixedLengthImportJob.xml @@ -12,10 +12,9 @@ - - + @@ -32,7 +31,7 @@ - + @@ -92,4 +91,9 @@ + + + + + \ No newline at end of file diff --git a/samples/src/main/resources/jobs/multilineJob.xml b/samples/src/main/resources/jobs/multilineJob.xml index e11e323c1..9675c7f6d 100644 --- a/samples/src/main/resources/jobs/multilineJob.xml +++ b/samples/src/main/resources/jobs/multilineJob.xml @@ -11,7 +11,6 @@ - @@ -76,5 +75,11 @@ + + + + + + \ No newline at end of file diff --git a/samples/src/main/resources/jobs/multilineOrderJob.xml b/samples/src/main/resources/jobs/multilineOrderJob.xml index b034bcd29..2c82f2088 100644 --- a/samples/src/main/resources/jobs/multilineOrderJob.xml +++ b/samples/src/main/resources/jobs/multilineOrderJob.xml @@ -1,151 +1,156 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 0 AND ? <= 9999999999 : 'Incorrect order ID' : 'error.order.id' } - { orderDate : isFutureDate(?) = FALSE : 'Future date is not allowed' : 'error.order.date.future' } - { totalLines : ? = size(lineItems) : 'Bad count of order lines' : 'error.order.lines.badcount'} - - { customer.registered : customer.businessCustomer = FALSE OR ? = TRUE : 'Business customer must be registered' : 'error.customer.registration'} - { customer.companyName : customer.businessCustomer = FALSE OR ? HAS TEXT : 'Company name for business customer is mandatory' : 'error.customer.companyname'} - { customer.firstName : customer.businessCustomer = TRUE OR ? HAS TEXT : 'Firstname for non-business customer is mandatory' : 'error.customer.firstname'} - { customer.lastName : customer.businessCustomer = TRUE OR ? HAS TEXT : 'Lastname name for non-business customer is mandatory' : 'error.customer.lastname'} - { customer.registrationId : customer.registered = FALSE OR (? > 0 AND ? < 99999999) : 'Incorrect registration ID' : 'error.customer.registrationid'} - - { billingAddress.addressee : ? HAS NO TEXT OR length(?) <= 60 : 'Maximum length for Addressee is 60 characters' : 'error.baddress.addresse.length'} - { billingAddress.addrLine1 : ? HAS TEXT AND length(?) <= 50 : 'Address line1 is mandatory and maximum length for address line1 is 50 characters' : 'error.baddress.addrline1.length'} - { billingAddress.addrLine2 : ? HAS NO TEXT OR length(?) <= 50 : 'Maximum length for address line2 is 50 characters' : 'error.baddress.addrline2.length'} - { billingAddress.city : ? HAS TEXT AND length(?) <= 30 : 'City is mandatory and maximum length for city is 30 characters' : 'error.baddress.city.length'} - { billingAddress.zipCode : ? HAS TEXT AND length(?) <= 50 : 'Zipcode is mandatory and maximum length for zipcode is 5 characters' : 'error.baddress.zipcode.length'} - { billingAddress.zipCode : match('[0-9]{5}',?) = TRUE : 'ZipCode must contain exactly 5 digits' : 'error.baddress.zipcode.format'} - { billingAddress.state : (? HAS NO TEXT AND billingAddress.country != 'United States') OR (? HAS TEXT AND length(?) <= 2) : 'Maximum length for state is 2 characters' : 'error.baddress.state.length'} - { billingAddress.country : ? HAS TEXT AND length(?) <= 50 : 'Country is mandatory and maximum length for country is 50 characters' : 'error.baddress.country.length'} - - { shippingAddress.addressee : shippingAddress IS NULL OR (? HAS TEXT AND length(?) <= 60) : 'Addressee is mandatory and maximum length for addressee is 60 characters' : 'error.saddress.addresse.length'} - { shippingAddress.addrLine1 : shippingAddress IS NULL OR (? HAS TEXT AND length(?) <= 50) : 'Address line1 is mandatory and maximum length for address line1 is 50 characters' : 'error.baddress.addrline1.length'} - { shippingAddress.addrLine2 : shippingAddress IS NULL OR (? HAS NO TEXT OR length(?) <= 50) : 'Maximum length for address line2 is 50 characters' : 'error.baddress.addrline2.length'} - { shippingAddress.city : shippingAddress IS NULL OR (? HAS TEXT AND length(?) <= 30) : 'City is mandatory and maximum length for city is 30 characters' : 'error.baddress.city.length'} - { shippingAddress.zipCode : shippingAddress IS NULL OR (? HAS TEXT AND length(?) <= 50) : 'Zipcode is mandatory and maximum length for zipcode is 5 characters' : 'error.baddress.zipcode.length'} - { shippingAddress.zipCode : shippingAddress IS NULL OR (match('[0-9]{5}',?) = TRUE) : 'Zipcode must contain exactly 5 digits' : 'error.baddress.zipcode.format'} - { shippingAddress.state : shippingAddress IS NULL OR ((? HAS NO TEXT AND billingAddress.country != 'United States') OR (? HAS TEXT AND length(?) <= 2)) : 'Maximum length for state is 2 characters' : 'error.baddress.state.length'} - { shippingAddress.country : shippingAddress IS NULL OR (? HAS TEXT AND length(?) <= 50) : 'Country is mandatory and maximum length for country is 50 characters' : 'error.baddress.country.length'} - - { billing.paymentId : ? IN 'VISA','AMEX','ECMC','DCIN','PAYP' : 'Invalid payment type' : 'error.billing.type' } - { billing.paymentDesc : match('[A-Z]{4}-[0-9]{10,11}',?) = TRUE : 'Invalid format of payment description' : 'error.billing.desc' } - - { shipping.shipperId : ? IN 'FEDX', 'UPS', 'DHL', 'DPD' : 'Invalid shipper ID' : 'error.shipping.shipper'} - { shipping.shippingTypeId : ? IN 'STD', 'EXP', 'AMS', 'AME' : 'Invalid shipping type' : 'error.shipping.type' } - { shipping.shippingInfo : ? HAS NO TEXT OR length(?) <= 100 : 'Maximum length for additional shipping info is 100 characters' } - - { lineItems : validateTotalItemsCount(totalItems,?) = TRUE : 'Bad count of total line items' : 'error.lineitems.badcount' } - { lineItems : validateIds(?) = TRUE : 'One or more invalid item IDs' : 'error.lineitems.id' } - { lineItems : validatePrices(?) = TRUE : 'One or more invalid item prices' : 'error.lineitems.price' } - { lineItems : validateDiscounts(?) = TRUE : 'One or more invalid item discounts' : 'error.lineitems.discount' } - { lineItems : validateShippingPrices(?) = TRUE : 'One or more invalid item shipping prices' : 'error.lineitems.shipping' } - { lineItems : validateHandlingPrices(?) = TRUE : 'One or more invalid item handling prices' : 'error.lineitems.handling' } - { lineItems : validateQuantities(?) = TRUE : 'One or more invalid item quantities' : 'error.lineitems.quantity' } - { lineItems : validateTotalPrices(?) = TRUE : 'One or more invalid item total prices' : 'error.lineitems.totalprice' } - ]]> - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 AND ? <= 9999999999 : 'Incorrect order ID' : 'error.order.id' } + { orderDate : isFutureDate(?) = FALSE : 'Future date is not allowed' : 'error.order.date.future' } + { totalLines : ? = size(lineItems) : 'Bad count of order lines' : 'error.order.lines.badcount'} + + { customer.registered : customer.businessCustomer = FALSE OR ? = TRUE : 'Business customer must be registered' : 'error.customer.registration'} + { customer.companyName : customer.businessCustomer = FALSE OR ? HAS TEXT : 'Company name for business customer is mandatory' : 'error.customer.companyname'} + { customer.firstName : customer.businessCustomer = TRUE OR ? HAS TEXT : 'Firstname for non-business customer is mandatory' : 'error.customer.firstname'} + { customer.lastName : customer.businessCustomer = TRUE OR ? HAS TEXT : 'Lastname name for non-business customer is mandatory' : 'error.customer.lastname'} + { customer.registrationId : customer.registered = FALSE OR (? > 0 AND ? < 99999999) : 'Incorrect registration ID' : 'error.customer.registrationid'} + + { billingAddress.addressee : ? HAS NO TEXT OR length(?) <= 60 : 'Maximum length for Addressee is 60 characters' : 'error.baddress.addresse.length'} + { billingAddress.addrLine1 : ? HAS TEXT AND length(?) <= 50 : 'Address line1 is mandatory and maximum length for address line1 is 50 characters' : 'error.baddress.addrline1.length'} + { billingAddress.addrLine2 : ? HAS NO TEXT OR length(?) <= 50 : 'Maximum length for address line2 is 50 characters' : 'error.baddress.addrline2.length'} + { billingAddress.city : ? HAS TEXT AND length(?) <= 30 : 'City is mandatory and maximum length for city is 30 characters' : 'error.baddress.city.length'} + { billingAddress.zipCode : ? HAS TEXT AND length(?) <= 50 : 'Zipcode is mandatory and maximum length for zipcode is 5 characters' : 'error.baddress.zipcode.length'} + { billingAddress.zipCode : match('[0-9]{5}',?) = TRUE : 'ZipCode must contain exactly 5 digits' : 'error.baddress.zipcode.format'} + { billingAddress.state : (? HAS NO TEXT AND billingAddress.country != 'United States') OR (? HAS TEXT AND length(?) <= 2) : 'Maximum length for state is 2 characters' : 'error.baddress.state.length'} + { billingAddress.country : ? HAS TEXT AND length(?) <= 50 : 'Country is mandatory and maximum length for country is 50 characters' : 'error.baddress.country.length'} + + { shippingAddress.addressee : shippingAddress IS NULL OR (? HAS TEXT AND length(?) <= 60) : 'Addressee is mandatory and maximum length for addressee is 60 characters' : 'error.saddress.addresse.length'} + { shippingAddress.addrLine1 : shippingAddress IS NULL OR (? HAS TEXT AND length(?) <= 50) : 'Address line1 is mandatory and maximum length for address line1 is 50 characters' : 'error.baddress.addrline1.length'} + { shippingAddress.addrLine2 : shippingAddress IS NULL OR (? HAS NO TEXT OR length(?) <= 50) : 'Maximum length for address line2 is 50 characters' : 'error.baddress.addrline2.length'} + { shippingAddress.city : shippingAddress IS NULL OR (? HAS TEXT AND length(?) <= 30) : 'City is mandatory and maximum length for city is 30 characters' : 'error.baddress.city.length'} + { shippingAddress.zipCode : shippingAddress IS NULL OR (? HAS TEXT AND length(?) <= 50) : 'Zipcode is mandatory and maximum length for zipcode is 5 characters' : 'error.baddress.zipcode.length'} + { shippingAddress.zipCode : shippingAddress IS NULL OR (match('[0-9]{5}',?) = TRUE) : 'Zipcode must contain exactly 5 digits' : 'error.baddress.zipcode.format'} + { shippingAddress.state : shippingAddress IS NULL OR ((? HAS NO TEXT AND billingAddress.country != 'United States') OR (? HAS TEXT AND length(?) <= 2)) : 'Maximum length for state is 2 characters' : 'error.baddress.state.length'} + { shippingAddress.country : shippingAddress IS NULL OR (? HAS TEXT AND length(?) <= 50) : 'Country is mandatory and maximum length for country is 50 characters' : 'error.baddress.country.length'} + + { billing.paymentId : ? IN 'VISA','AMEX','ECMC','DCIN','PAYP' : 'Invalid payment type' : 'error.billing.type' } + { billing.paymentDesc : match('[A-Z]{4}-[0-9]{10,11}',?) = TRUE : 'Invalid format of payment description' : 'error.billing.desc' } + + { shipping.shipperId : ? IN 'FEDX', 'UPS', 'DHL', 'DPD' : 'Invalid shipper ID' : 'error.shipping.shipper'} + { shipping.shippingTypeId : ? IN 'STD', 'EXP', 'AMS', 'AME' : 'Invalid shipping type' : 'error.shipping.type' } + { shipping.shippingInfo : ? HAS NO TEXT OR length(?) <= 100 : 'Maximum length for additional shipping info is 100 characters' } + + { lineItems : validateTotalItemsCount(totalItems,?) = TRUE : 'Bad count of total line items' : 'error.lineitems.badcount' } + { lineItems : validateIds(?) = TRUE : 'One or more invalid item IDs' : 'error.lineitems.id' } + { lineItems : validatePrices(?) = TRUE : 'One or more invalid item prices' : 'error.lineitems.price' } + { lineItems : validateDiscounts(?) = TRUE : 'One or more invalid item discounts' : 'error.lineitems.discount' } + { lineItems : validateShippingPrices(?) = TRUE : 'One or more invalid item shipping prices' : 'error.lineitems.shipping' } + { lineItems : validateHandlingPrices(?) = TRUE : 'One or more invalid item handling prices' : 'error.lineitems.handling' } + { lineItems : validateQuantities(?) = TRUE : 'One or more invalid item quantities' : 'error.lineitems.quantity' } + { lineItems : validateTotalPrices(?) = TRUE : 'One or more invalid item total prices' : 'error.lineitems.totalprice' } + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/samples/src/main/resources/jobs/simpleTaskletJob.xml b/samples/src/main/resources/jobs/simpleTaskletJob.xml index 847316b7c..1968d76e5 100644 --- a/samples/src/main/resources/jobs/simpleTaskletJob.xml +++ b/samples/src/main/resources/jobs/simpleTaskletJob.xml @@ -11,7 +11,6 @@ - diff --git a/samples/src/main/resources/jobs/tradeJob.xml b/samples/src/main/resources/jobs/tradeJob.xml index cec0aeb0d..426088ccc 100644 --- a/samples/src/main/resources/jobs/tradeJob.xml +++ b/samples/src/main/resources/jobs/tradeJob.xml @@ -125,4 +125,8 @@ value="20070122.testStream.CustomerReportStep.TEMP.txt" /> + + + + \ No newline at end of file diff --git a/samples/src/main/resources/jobs/xmlJob.xml b/samples/src/main/resources/jobs/xmlJob.xml index 4d7e84f51..5c7940833 100644 --- a/samples/src/main/resources/jobs/xmlJob.xml +++ b/samples/src/main/resources/jobs/xmlJob.xml @@ -116,4 +116,9 @@ + + + + + \ No newline at end of file diff --git a/samples/src/main/resources/simple-container-definition.xml b/samples/src/main/resources/simple-container-definition.xml index 6c5ca9446..9afa44ca1 100644 --- a/samples/src/main/resources/simple-container-definition.xml +++ b/samples/src/main/resources/simple-container-definition.xml @@ -80,7 +80,6 @@ - diff --git a/samples/src/test/java/org/springframework/batch/sample/CompositeProcessorSampleFunctionalTests.java b/samples/src/test/java/org/springframework/batch/sample/CompositeProcessorSampleFunctionalTests.java index 70b0ab2ad..178ce0fa8 100644 --- a/samples/src/test/java/org/springframework/batch/sample/CompositeProcessorSampleFunctionalTests.java +++ b/samples/src/test/java/org/springframework/batch/sample/CompositeProcessorSampleFunctionalTests.java @@ -35,7 +35,7 @@ public class CompositeProcessorSampleFunctionalTests extends AbstractLifecycleSp // @Override protected String[] getConfigLocations() { - return new String[]{"jobs/compositeProcessorSample.xml"}; + return new String[]{"jobs/compositeProcessorSampleJob.xml"}; } /* (non-Javadoc) diff --git a/samples/src/test/java/org/springframework/batch/sample/dao/FlatFileOrderWriterTests.java b/samples/src/test/java/org/springframework/batch/sample/dao/FlatFileOrderWriterTests.java index 054d0c89f..ad356631f 100644 --- a/samples/src/test/java/org/springframework/batch/sample/dao/FlatFileOrderWriterTests.java +++ b/samples/src/test/java/org/springframework/batch/sample/dao/FlatFileOrderWriterTests.java @@ -46,24 +46,6 @@ public class FlatFileOrderWriterTests extends TestCase { writer.setOutputSource(output); } - public void testOpen() { - - //call tested method - writer.open(); - //verify method calls - assertEquals(1, list.size()); - - } - - public void testClose() { - - //call tested method - writer.close(); - //verify method calls - assertEquals(1, list.size()); - - } - public void testWrite() { //Create and set-up Order