1 package org.kuali.ole.docstore.process;
2
3 import org.junit.Before;
4 import org.junit.Ignore;
5 import org.junit.Test;
6 import org.kuali.ole.BaseTestCase;
7 import org.kuali.ole.OleDocStoreData;
8 import org.kuali.ole.RepositoryBrowser;
9 import org.kuali.ole.docstore.metrics.reindex.ReIndexingBatchStatus;
10 import org.kuali.ole.docstore.metrics.reindex.ReIndexingDocTypeStatus;
11 import org.kuali.ole.docstore.metrics.reindex.ReIndexingStatus;
12 import org.kuali.ole.docstore.model.enums.DocCategory;
13 import org.kuali.ole.docstore.model.enums.DocFormat;
14 import org.kuali.ole.docstore.model.enums.DocType;
15 import org.slf4j.Logger;
16 import org.slf4j.LoggerFactory;
17
18 import java.util.*;
19
20 import static org.junit.Assert.fail;
21
22
23
24
25
26
27
28 @Ignore
29 @Deprecated
30 public class RebuildIndexesHandler_UT extends BaseTestCase {
31
32 private static final Logger LOG = LoggerFactory.getLogger(RebuildIndexesHandler_UT.class);
33
34 @Before
35 public void setUp() throws Exception {
36 System.setProperty("OLE_DOCSTORE_USE_DISCOVERY", Boolean.TRUE.toString());
37 }
38
39 @Ignore
40 public void testRebuildIndexesForMarc() {
41 try {
42 RebuildIndexesHandler reBuilder = RebuildIndexesHandler.getInstance();
43 String category = DocCategory.WORK.getCode();
44 String type = DocType.INSTANCE.getDescription();
45 String format = DocFormat.MARC.getCode();
46 reBuilder.startProcess(null, null, null);
47 reBuilder.run();
48 reBuilder.stopProcess();
49 reBuilder.startProcess(category, type, format);
50 reBuilder.run();
51 reBuilder.stopProcess();
52 } catch (Exception e) {
53 LOG.info(e.getMessage(),e);
54 fail();
55 }
56 }
57
58 @Test
59 public void testReIndexingBatchStatus() {
60 ReIndexingBatchStatus reIndexingBatchStatus = new ReIndexingBatchStatus();
61 reIndexingBatchStatus.setBatchEndTime(reIndexingBatchStatus.getBatchEndTime());
62 reIndexingBatchStatus.setBatchIndexingTime(reIndexingBatchStatus.getBatchIndexingTime());
63 reIndexingBatchStatus.setBatchLoadTime(reIndexingBatchStatus.getBatchLoadTime());
64 reIndexingBatchStatus.setBatchStartTime(reIndexingBatchStatus.getBatchStartTime());
65 reIndexingBatchStatus.setBatchTotalTime(reIndexingBatchStatus.getBatchTotalTime());
66 reIndexingBatchStatus.setRecordsProcessed(reIndexingBatchStatus.getRecordsProcessed());
67 reIndexingBatchStatus.setRecordsRemaining(reIndexingBatchStatus.getRecordsRemaining());
68 reIndexingBatchStatus.setStatus(reIndexingBatchStatus.getStatus());
69 }
70
71 @Test
72 public void testReIndexingStatus() {
73 ReIndexingStatus reIndexingStatus = ReIndexingStatus.getInstance();
74 reIndexingStatus.reset();
75 reIndexingStatus.getDocTypeList();
76 reIndexingStatus.startDocType(DocCategory.WORK.getCode(), DocType.BIB.getCode(), DocFormat.MARC.getCode());
77 reIndexingStatus.getDocTypeList();
78 ReIndexingDocTypeStatus reIndexingDocTypeStatus = new ReIndexingDocTypeStatus();
79 List list = new ArrayList<ReIndexingDocTypeStatus>();
80 list.add(reIndexingDocTypeStatus);
81 ReIndexingBatchStatus reIndexingBatchStatus = new ReIndexingBatchStatus();
82 List reIndexingBatchStatusList = new ArrayList<ReIndexingBatchStatus>();
83 reIndexingBatchStatusList.add(reIndexingBatchStatus);
84 reIndexingDocTypeStatus.setReIndBatStatusList(reIndexingBatchStatusList);
85 reIndexingStatus.setReIndTypStatusList(list);
86 LOG.info("ReIndexingStatsuList : " + reIndexingStatus.getReIndTypStatusList());
87 reIndexingStatus.getJsonString();
88 reIndexingStatus.toString();
89 }
90
91 @Test
92 public void testReIndexingDocTypeStatus() {
93 ReIndexingDocTypeStatus reIndexingDocTypeStatus = new ReIndexingDocTypeStatus();
94 reIndexingDocTypeStatus.getDocCategory();
95 reIndexingDocTypeStatus.setReIndBatStatusList(reIndexingDocTypeStatus.getReIndBatStatusList());
96 reIndexingDocTypeStatus.getDocCategory();
97 reIndexingDocTypeStatus.getDocFormat();
98 reIndexingDocTypeStatus.getDocType();
99 reIndexingDocTypeStatus.getStatus();
100 }
101
102 }