1 package org.kuali.ole.repository;
2
3 import org.apache.commons.io.FileUtils;
4 import org.junit.Ignore;
5 import org.junit.Test;
6 import org.kuali.ole.BaseTestCase;
7 import org.kuali.ole.docstore.model.xmlpojo.ingest.Request;
8 import org.kuali.ole.docstore.model.xmlpojo.ingest.RequestDocument;
9 import org.kuali.ole.docstore.model.xmlpojo.ingest.Response;
10 import org.kuali.ole.docstore.model.xstream.ingest.RequestHandler;
11 import org.kuali.ole.docstore.service.BeanLocator;
12 import org.kuali.ole.docstore.service.DocumentIndexer;
13 import org.kuali.ole.docstore.service.DocumentIngester;
14 import org.kuali.ole.docstore.service.IngestNIndexHandlerService;
15 import org.kuali.ole.logger.DocStoreLogger;
16
17 import java.io.File;
18
19
20
21
22
23
24
25
26 @Ignore
27 @Deprecated
28 public class DocumentStoreManager_UT extends BaseTestCase {
29
30 DocStoreLogger docStoreLogger = new DocStoreLogger(this.getClass().getName());
31
32 @Test
33 public void testDocumentStoreManager() throws Exception {
34 DocumentStoreManager documentStoreManager = BeanLocator.getDocumentStoreManager();
35 File inputDir = new File(this.getClass().getResource("/org/kuali/ole/repository/request.xml").toURI());
36 String input = FileUtils.readFileToString(inputDir);
37 RequestHandler requestHandler = new RequestHandler();
38 Request request = requestHandler.toObject(input);
39 IngestNIndexHandlerService ingestNIndexHandlerService = new IngestNIndexHandlerService();
40 ingestNIndexHandlerService.setRequestHandler(requestHandler);
41 ingestNIndexHandlerService.setDocumentIndexer(new DocumentIndexer());
42 ingestNIndexHandlerService.setDocumentIngester(new DocumentIngester());
43 RequestDocument requestDocument = request.getRequestDocuments().get(0);
44 Response xmlResponse = ingestNIndexHandlerService.ingestNIndexRequestDocuments(request);
45 docStoreLogger.log("Response :" + xmlResponse);
46 DeleteManager deleteManager = (DeleteManager) BeanLocator.getBean("deleteManagerService");
47 CheckoutManager checkoutManager = (CheckoutManager) BeanLocator.getBean("checkoutManagerService");
48 CheckinManager checkinManager = (CheckinManager) BeanLocator.getBean("checkinManagerService");
49 documentStoreManager.setCheckinManager(checkinManager);
50 documentStoreManager.setDeleteManager(deleteManager);
51 documentStoreManager.setRequestHandler(requestHandler);
52 documentStoreManager.setCheckoutManager(checkoutManager);
53 documentStoreManager.updateRecord(requestDocument);
54 documentStoreManager.processDeleteRequest(input);
55 documentStoreManager.checkOutMultiPart(request);
56 documentStoreManager.addReference("1", "2", "ole-khuntly", "checkIn");
57 documentStoreManager.checkOut(requestDocument.getUuid(), requestDocument.getUser(), requestDocument.getOperation());
58 documentStoreManager.checkOutBinary(requestDocument.getUuid(), requestDocument.getUser(), requestDocument.getOperation(), requestDocument.getFormat());
59 }
60 }