1 package org.kuali.ole.web;
2
3 import org.junit.After;
4 import org.junit.Before;
5 import org.junit.Ignore;
6 import org.junit.Test;
7 import org.kuali.ole.base.BaseTestCase;
8 import org.kuali.ole.docstore.model.xmlpojo.ingest.Response;
9 import org.kuali.ole.service.MultiPartBagRequestClient;
10 import org.springframework.mock.web.MockHttpServletRequest;
11 import org.springframework.mock.web.MockHttpServletResponse;
12
13 import java.io.File;
14 import java.util.List;
15
16
17
18
19
20
21
22
23 @Ignore
24 public class MultiPartBagRequestClientServlet_UT extends BaseTestCase {
25 private MockHttpServletRequest mockRequest = new MockHttpServletRequest();
26 private MockHttpServletResponse mockResponse = new MockHttpServletResponse();
27 MultiPartBagRequestClientServlet bagRequestClientServlet = new MultiPartBagRequestClientServlet();
28
29 @Override
30 @Before
31 public void setUp() throws Exception {
32 super.setUp();
33 }
34
35 @After
36 public void tearDown() throws Exception {
37 }
38 @Ignore
39 @Test
40 public void testMultiPartBagItIngest() throws Exception {
41 File inputDir = new File(this.getClass().getResource("license/ingest").toURI());
42 mockRequest.setParameter("restUrl","http://dev.docstore.ole.kuali.org/rest/documents" );
43 mockRequest.setParameter("requestFolderPath", inputDir.getPath());
44 bagRequestClientServlet.doGet(mockRequest, mockResponse);
45
46
47
48
49
50
51
52 }
53 @Ignore
54 @Test
55 public void testMultiPartBagItCheckout() throws Exception {
56 File inputDir = new File(this.getClass().getResource("license/checkout").toURI());
57 MultiPartBagRequestClient multiPartBagRequestClient = new MultiPartBagRequestClient();
58 List<Response> responseList = multiPartBagRequestClient.runMultiPartRequestsAtLocation(inputDir.getPath(), null);
59 Response response = responseList.get(0);
60 String responseString = new org.kuali.ole.docstore.model.xstream.ingest.ResponseHandler().toXML(response);
61 System.out.println("bagIt Checkout Response" + responseString);
62
63 }
64 @Ignore
65 @Test
66 public void testMultiPartBagItCheckin() throws Exception {
67 File inputDir = new File(this.getClass().getResource("license/checkin").toURI());
68 MultiPartBagRequestClient multiPartBagRequestClient = new MultiPartBagRequestClient();
69 List<Response> responseList = multiPartBagRequestClient.runMultiPartRequestsAtLocation(inputDir.getPath(), null);
70 Response response = responseList.get(0);
71 String responseString = new org.kuali.ole.docstore.model.xstream.ingest.ResponseHandler().toXML(response);
72 System.out.println("bagIt Checkin Response" + responseString);
73
74 }
75 @Ignore
76 @Test
77 public void testMultiPartBagItDelete() throws Exception {
78 File inputDir = new File(this.getClass().getResource("license/delete").toURI());
79 MultiPartBagRequestClient multiPartBagRequestClient = new MultiPartBagRequestClient();
80 List<Response> responseList = multiPartBagRequestClient.runMultiPartRequestsAtLocation(inputDir.getPath(), null);
81 Response response = responseList.get(0);
82 String responseString = new org.kuali.ole.docstore.model.xstream.ingest.ResponseHandler().toXML(response);
83 System.out.println("bagIt Delete Response" + responseString);
84
85 }
86 }