View Javadoc

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   * Created by IntelliJ IDEA.
15   * User: ND6967
16   * Date: 3/13/12
17   * Time: 5:58 PM
18   * To change this template use File | Settings | File Templates.
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       * Method to setUp
27       *
28       * @throws java.lang.Exception
29       */
30      @Before
31      public void setUp() throws Exception {
32          DocStoreCamelContext.getInstance();
33      }
34  
35      /**
36       * Method to tearDown
37       *
38       * @throws java.lang.Exception
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       * Test method for {@link org.kuali.ole.docstore.process.DocStoreCamelContext#addBulkIngestNIndexProcess(java.lang.String, java.lang.String, java.lang.String)}.
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              //fail("Bulk Ingest Failed...");
79  
80          }
81      }
82  
83  
84  }