View Javadoc
1   package org.kuali.ole;
2   
3   import org.junit.Before;
4   import org.junit.Ignore;
5   import org.junit.Test;
6   import org.kuali.ole.service.OleExplainOperationService;
7   import org.kuali.ole.serviceimpl.OleDiagnosticsServiceImpl;
8   import org.kuali.ole.serviceimpl.OleExplainOperationServiceImpl;
9   import org.kuali.rice.core.api.config.property.Config;
10  import org.mockito.Mock;
11  import org.mockito.Mockito;
12  import org.mockito.MockitoAnnotations;
13  import org.slf4j.Logger;
14  import org.slf4j.LoggerFactory;
15  
16  import java.util.HashMap;
17  import java.util.Map;
18  
19  import static junit.framework.Assert.assertNotNull;
20  
21  /**
22   * Created with IntelliJ IDEA.
23   * User: ?
24   * Date: 7/19/12
25   * Time: 4:34 PM
26   * To change this template use File | Settings | File Templates.
27   */
28  @Ignore
29  @Deprecated
30  public class OleExplainOperationService_UT extends BaseTestCase{
31  
32      private static Logger LOG = LoggerFactory.getLogger(OleExplainOperationService_UT.class);
33      private OleExplainOperationService oleExplainOperationServiceService = new OleExplainOperationServiceImpl();
34  
35      @Mock
36      private Config mockConfig;
37  
38      @Before
39      public void setUp() throws Exception {
40          MockitoAnnotations.initMocks(this);
41          Mockito.when(mockConfig.getProperty(OleSRUConstants.STARTRECORD)).thenReturn("5");
42          Mockito.when(mockConfig.getProperty(OleSRUConstants.MAXRECORD)).thenReturn("5");
43          Mockito.when(mockConfig.getProperty(OleSRUConstants.EXPLAIN_SERVER_DATABASE_INFO)).thenReturn("5");
44          Mockito.when(mockConfig.getProperty(OleSRUConstants.EXPLAIN_SERVER_HOST)).thenReturn("5");
45          Mockito.when(mockConfig.getProperty(OleSRUConstants.EXPLAIN_SERVER_METHOD)).thenReturn("5");
46          Mockito.when(mockConfig.getProperty(OleSRUConstants.EXPLAIN_SERVER_PORT)).thenReturn("5");
47          Mockito.when(mockConfig.getProperty(OleSRUConstants.EXPLAIN_SERVER_PROTOCOL)).thenReturn("5");
48          Mockito.when(mockConfig.getProperty(OleSRUConstants.EXPLAIN_SERVER_TRANSPORT)).thenReturn("5");
49          Mockito.when(mockConfig.getProperty(OleSRUConstants.EXPLAIN_SERVER_VERSION)).thenReturn("5");
50          Mockito.when(mockConfig.getProperty(OleSRUConstants.EXPLAIN_DATABASE_LANG)).thenReturn("5");
51          Mockito.when(mockConfig.getProperty(OleSRUConstants.EXPLAIN_DATABASE_PRIMARY)).thenReturn("5");
52          ((OleExplainOperationServiceImpl) oleExplainOperationServiceService).setCurrentContextConfig(mockConfig);
53  
54      }
55  
56      @Test
57      public void testExplainResponse() throws Exception{
58  
59          String explainXML = null;
60          explainXML = oleExplainOperationServiceService.getExplainResponse(getReqParameters());
61          assertNotNull(explainXML);
62      }
63      public Map getReqParameters() {
64  
65          HashMap reqParamMap=new HashMap();
66          reqParamMap.put(OleSRUConstants.OperationType,OleSRUConstants.SEARCH_RETRIEVE);
67          reqParamMap.put(OleSRUConstants.VERSION,"1.1");
68          reqParamMap.put(OleSRUConstants.RECORD_PACKING,"xml");
69          return reqParamMap;
70  
71      }
72  }