View Javadoc
1   package org.kuali.ole.web;
2   
3   import org.junit.After;
4   import org.junit.Before;
5   import org.junit.Test;
6   import org.kuali.ole.docstore.metrics.reindex.ReIndexingStatus;
7   import org.kuali.ole.docstore.model.enums.DocCategory;
8   import org.kuali.ole.docstore.model.enums.DocFormat;
9   import org.kuali.ole.docstore.model.enums.DocType;
10  import org.kuali.ole.docstore.process.RebuildIndexesHandler;
11  
12  /**
13   * Created with IntelliJ IDEA.
14   * User: ?
15   * Date: 12/17/12
16   * Time: 1:13 AM
17   * To change this template use File | Settings | File Templates.
18   */
19  public class RebuildIndexServlet_UT {
20      /**
21       * Method to setUp
22       *
23       * @throws Exception
24       */
25      @Before
26      public void setUp() throws Exception {
27      }
28  
29      /**
30       * Method to tearDown
31       *
32       * @throws Exception
33       */
34      @After
35      public void tearDown() throws Exception {
36      }
37  
38      @Test
39      public void testStartRebuildIndex() throws Exception {
40          RebuildIndexesHandler rebuildIndexesHandler = RebuildIndexesHandler.getInstance();
41          String result = rebuildIndexesHandler
42                  .startProcess(DocCategory.WORK.getDescription(), DocType.BIB.getDescription(),
43                                DocFormat.MARC.getDescription());
44  
45          System.out.println(result);
46      }
47  
48      @Test
49      public void testShowRebuildIndexStatus() throws Exception {
50          RebuildIndexesHandler rebuildIndexesHandler = RebuildIndexesHandler.getInstance();
51          rebuildIndexesHandler
52                  .startProcess(DocCategory.WORK.getDescription(), DocType.BIB.getDescription(),
53                                DocFormat.MARC.getDescription());
54  
55          ReIndexingStatus reIndexingStatus = ReIndexingStatus.getInstance();
56  
57          String jsonString = reIndexingStatus.getJsonString();
58          System.out.println("json String:" + jsonString);
59      }
60  
61      @Test
62      public void testClearRebuildIndexStatus() throws Exception {
63          RebuildIndexesHandler rebuildIndexesHandler = RebuildIndexesHandler.getInstance();
64          String result = rebuildIndexesHandler
65                  .startProcess(DocCategory.WORK.getDescription(), DocType.BIB.getDescription(),
66                                DocFormat.MARC.getDescription());
67  
68          ReIndexingStatus reIndexingStatus = ReIndexingStatus.getInstance();
69          reIndexingStatus.reset();
70          String jsonString = reIndexingStatus.getJsonString();
71          System.out.println("json String:" + jsonString);
72      }
73  
74  
75      @Test
76      public void testStopRebuildIndexStatus() throws Exception {
77          RebuildIndexesHandler rebuildIndexesHandler = RebuildIndexesHandler.getInstance();
78          rebuildIndexesHandler.startProcess(DocCategory.WORK.getDescription(), DocType.BIB.getDescription(),
79                                             DocFormat.MARC.getDescription());
80          String result = rebuildIndexesHandler.stopProcess();
81          System.out.println(result);
82  
83  
84      }
85  }