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.discovery.servlet.DocumentConfigServlet;
7   import org.kuali.ole.docstore.discovery.web.struts.action.DiscoveryAction;
8   import org.springframework.mock.web.MockHttpServletRequest;
9   import org.springframework.mock.web.MockHttpServletResponse;
10  
11  import javax.servlet.ServletException;
12  import java.io.*;
13  import java.net.URL;
14  
15  /**
16   * Created with IntelliJ IDEA.
17   * User: ?
18   * Date: 12/17/12
19   * Time: 1:52 AM
20   * To change this template use File | Settings | File Templates.
21   */
22  public class DocumentConfigServlet_UT {
23      private MockHttpServletRequest  mockRequest  = new MockHttpServletRequest();
24      private MockHttpServletResponse mockResponse = new MockHttpServletResponse();
25      DocumentConfigServlet documentConfigServlet = new DocumentConfigServlet();
26  
27      /**
28       * Method to setUp
29       *
30       * @throws Exception
31       */
32      @Before
33      public void setUp() throws Exception {
34      }
35  
36      /**
37       * Method to tearDown
38       *
39       * @throws Exception
40       */
41      @After
42      public void tearDown() throws Exception {
43      }
44  
45      @Test
46      public void testDocumentConfig() throws Exception {
47          URL resource = getClass().getResource("/DocumentConfig.xml");
48          File file = new File(resource.toURI());
49          System.setProperty("document.config.file", file.getPath());
50          documentConfigServlet.doGet(mockRequest, mockResponse);
51      }
52  }