OPEN - issue BATCH-773: Refactor and extend ExportedJobLauncher to JobOperator

Add new interfaces and exceptions.  Re-align JobInstanceDao.
This commit is contained in:
dsyer
2008-08-08 14:04:55 +00:00
parent fca856dc7b
commit 61ccafa25c
17 changed files with 377 additions and 134 deletions

View File

@@ -50,10 +50,10 @@ public class FlatFileOrderAggregatorTests {
order.setTotalPrice(BigDecimal.valueOf(0));
// create aggregator stub
LineAggregator<String[]> aggregator = new DelimitedLineAggregator<String>();
LineAggregator<Object[]> aggregator = new DelimitedLineAggregator<Object>();
// create map of aggregators and set it to writer
Map<String, LineAggregator<String[]>> aggregators = new HashMap<String, LineAggregator<String[]>>();
Map<String, LineAggregator<Object[]>> aggregators = new HashMap<String, LineAggregator<Object[]>>();
OrderTransformer converter = new OrderTransformer();
aggregators.put("header", aggregator);

View File

@@ -1,62 +0,0 @@
/*
* Copyright 2006-2008 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.batch.sample.domain.order;
import static org.junit.Assert.assertTrue;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
import org.junit.Test;
import org.springframework.batch.item.file.transform.LineAggregator;
import org.springframework.batch.item.file.transform.PassThroughLineAggregator;
import org.springframework.batch.sample.domain.order.internal.OrderTransformer;
/**
* @author Dave Syer
*
*/
public class OrderTransformerTests {
private OrderTransformer converter = new OrderTransformer();
@Test
public void testConvert() throws Exception {
converter.setAggregators(new HashMap<String, LineAggregator<String[]>>() {
{
put("header", new PassThroughLineAggregator<String[]>());
put("customer", new PassThroughLineAggregator<String[]>());
put("address", new PassThroughLineAggregator<String[]>());
put("billing", new PassThroughLineAggregator<String[]>());
put("item", new PassThroughLineAggregator<String[]>());
put("footer", new PassThroughLineAggregator<String[]>());
}
});
Order order = new Order();
order.setOrderDate(new Date());
order.setCustomer(new Customer());
order.setBillingAddress(new Address());
order.setBilling(new BillingInfo());
order.setLineItems(new ArrayList<LineItem>());
order.setTotalPrice(new BigDecimal(10));
Object result = converter.transform(order);
assertTrue(result instanceof Collection);
}
}