View Javadoc
1   package org.kuali.ole.docstore.process;
2   
3   import org.apache.camel.Exchange;
4   import org.apache.camel.ExchangePattern;
5   import org.apache.camel.impl.DefaultCamelContext;
6   import org.apache.camel.impl.DefaultExchange;
7   import org.junit.Test;
8   import org.kuali.ole.BaseTestCase;
9   import org.slf4j.Logger;
10  import org.slf4j.LoggerFactory;
11  
12  
13  /**
14   * Created with IntelliJ IDEA.
15   * User: ?
16   * Date: 12/22/12
17   * Time: 12:03 PM
18   * To change this template use File | Settings | File Templates.
19   */
20  public class BulkIngestNIndexRouteBuilder_UT extends BaseTestCase {
21  
22      private static final Logger LOG = LoggerFactory.getLogger(BulkIngestNIndexRouteBuilder_UT.class);
23      Exchange exchange = new DefaultExchange(new DefaultCamelContext(), ExchangePattern.InOut);
24  
25      @Test
26      public void testBodyAggregator() {
27          BodyAggregator bodyAggregator = new BodyAggregator();
28          bodyAggregator.setFileIngestStatistics(bodyAggregator.getFileIngestStatistics());
29          exchange.setProperty("CamelSplitIndex", new Integer("0"));
30          bodyAggregator.aggregate(null, exchange);
31      }
32  
33      @Test
34      public void testBulkIngestNIndexProcessor() throws Exception {
35          BulkIngestNIndexProcessor bulkIngestNIndexProcessor = new BulkIngestNIndexProcessor("user", "action");
36          bulkIngestNIndexProcessor.setBulkLoadStatistics(bulkIngestNIndexProcessor.getBulkLoadStatistics());
37          bulkIngestNIndexProcessor.setBulkProcessRequest(bulkIngestNIndexProcessor.getBulkProcessRequest());
38          //bulkIngestNIndexProcessor.process(exchange);
39      }
40  
41      @Test
42      public void testSplitPredicate() {
43          SplitPredicate splitPredicate = new SplitPredicate(new Integer("1000"));
44          exchange.setProperty("CamelFileExchangeFile", new String("CamelFileExchangeFile"));
45          exchange.setProperty("CamelSplitComplete", new Boolean("true"));
46          exchange.setProperty("CamelAggregatedSize", new Integer("000"));
47          splitPredicate.matches(exchange);
48          exchange.setProperty("CamelFileExchangeFile", new String("CamelFileExchangeFile"));
49          exchange.setProperty("CamelSplitComplete", new String("CamelSplitComplete"));
50          exchange.setProperty("CamelAggregatedSize", new Integer("1000"));
51          splitPredicate.matches(exchange);
52          exchange.setProperty("CamelFileExchangeFile", new String("CamelFileExchangeFile"));
53          exchange.setProperty("CamelSplitComplete", new String("CamelSplitComplete"));
54          exchange.setProperty("CamelAggregatedSize", new Integer("000"));
55          splitPredicate.matches(exchange);
56      }
57  
58  }