View Javadoc
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   * Created with IntelliJ IDEA.
18   * User: ?
19   * Date: 12/17/12
20   * Time: 12:56 AM
21   * To change this template use File | Settings | File Templates.
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();    //To change body of overridden methods use File | Settings | File Templates.
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          /*MultiPartBagRequestClient multiPartBagRequestClient = new MultiPartBagRequestClient();
47          List<Response> responseList = multiPartBagRequestClient.runMultiPartRequestsAtLocation(inputDir.getPath(), null);
48          Response response = responseList.get(0);
49          String responseString = new org.kuali.ole.docstore.model.xstream.ingest.ResponseHandler().toXML(response);
50          System.out.println("bagIt Ingest Response" + responseString);
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  }