1 package org.kuali.ole.web;
2
3 import org.apache.commons.io.FileUtils;
4 import org.junit.After;
5 import org.junit.Before;
6 import org.junit.Ignore;
7 import org.junit.Test;
8 import org.kuali.ole.RepositoryBrowser;
9 import org.kuali.ole.base.BaseTestCase;
10 import org.kuali.ole.docstore.indexer.solr.IndexerService;
11 import org.kuali.ole.docstore.model.enums.DocCategory;
12 import org.kuali.ole.docstore.model.enums.DocFormat;
13 import org.kuali.ole.docstore.model.enums.DocType;
14 import org.mockito.Mock;
15 import org.springframework.mock.web.MockHttpServletRequest;
16 import org.springframework.mock.web.MockHttpServletResponse;
17 import org.springframework.mock.web.MockServletContext;
18
19 import java.util.ArrayList;
20 import java.util.List;
21
22
23
24
25
26
27
28
29 @Ignore
30 @Deprecated
31 public class GetUUIDServlet_UT
32 extends BaseTestCase {
33
34 private RepositoryBrowser repositoryBrowser;
35 private MockHttpServletRequest mockRequest = new MockHttpServletRequest();
36 private MockHttpServletResponse mockResponse = new MockHttpServletResponse();
37 private MockServletContext mockServletContext = new MockServletContext();
38 GetUUIDServlet getUUIDServlet = new GetUUIDServlet();
39 private static final String RESULTS_JSP =
40 "/getUUIDResults.jsp";
41 @Mock
42 private IndexerService mockIndexerService;
43
44 @Override
45 @Before
46 public void setUp() throws Exception {
47 super.setUp();
48 }
49
50 @After
51 public void tearDown() throws Exception {
52 }
53
54 @Test
55 public void testGetUUIDs() throws Exception {
56 List<String> uuidsList = new ArrayList<String>();
57 String category = DocCategory.WORK.getDescription();
58 String type = DocType.BIB.getDescription();
59 String format = DocFormat.MARC.getDescription();
60 String numUUIDs = "4";
61
62
63
64
65
66
67
68
69
70
71
72
73 try {
74 if (null != category && null != format && null != numUUIDs) {
75 uuidsList = getRepositoryBrowser()
76 .getUUIDs(category.toLowerCase(), type.toLowerCase(), format.toLowerCase(),
77 new Integer(numUUIDs));
78 }
79 }
80 catch (Exception e) {
81 uuidsList.add(e.getMessage());
82 }
83
84 if(uuidsList.size() > 0 ){
85 System.out.println("UUIDs");
86 for(String uuid : uuidsList){
87 System.out.println(uuid);
88 }
89 }
90
91 }
92
93 public RepositoryBrowser getRepositoryBrowser() {
94 if (null == repositoryBrowser) {
95 repositoryBrowser = new RepositoryBrowser();
96 }
97 return repositoryBrowser;
98 }
99 }