1   package org.kuali.ole.docstore.process;
2   
3   import org.junit.After;
4   import org.junit.Before;
5   import org.junit.Test;
6   import org.slf4j.Logger;
7   import org.slf4j.LoggerFactory;
8   
9   import java.net.URL;
10  
11  import static org.junit.Assert.fail;
12  
13  
14  
15  
16  
17  
18  
19  
20  public class BulkLoadHandler_AT {
21      private String jobId;
22  
23      private static final Logger LOG = LoggerFactory.getLogger(BulkLoadHandler_AT.class);
24  
25      
26  
27  
28  
29  
30      @Before
31      public void setUp() throws Exception {
32          DocStoreCamelContext.getInstance();
33      }
34  
35      
36  
37  
38  
39  
40      @After
41      public void tearDown() throws Exception {
42          for (int i = 0; i < 5; i++) {
43              Thread.sleep(5000);
44              System.out.println("Status: " + BulkLoadHandler.getInstance().getStatus());
45          }
46          DocStoreCamelContext.getInstance().stop();
47          Thread.sleep(5000);
48          System.out.println("Status: " + BulkLoadHandler.getInstance().getStatus());
49  
50      }
51  
52      
53  
54  
55      @Test
56      public final void testBulkIngestAndIndex() {
57          URL url = ClassLoader.getSystemClassLoader().getResource("org/kuali/ole/bulkIngest/");
58          try {
59              jobId = url.getFile();
60              BulkLoadHandler.getInstance()
61                      .loadBulk(jobId, ProcessParameters.BULK_DEFAULT_USER, ProcessParameters.BULK_DEFUALT_ACTION);
62          } catch (Exception e) {
63              LOG.info(e.getMessage());
64              fail("Bulk Ingest Failed...");
65  
66          }
67      }
68  
69      @Test
70      public final void testBulkIngestAndIndexMetric() {
71          URL url = ClassLoader.getSystemClassLoader().getResource("org/kuali/ole/bulkIngest/bulkIngestNIndexMetrics");
72          try {
73              jobId = url.getFile();
74              BulkLoadHandler.getInstance()
75                      .loadBulk(jobId, ProcessParameters.BULK_DEFAULT_USER, ProcessParameters.BULK_DEFUALT_ACTION);
76          } catch (Exception e) {
77              LOG.info(e.getMessage());
78              
79  
80          }
81      }
82  
83  
84  }