View Javadoc
1   package org.kuali.ole.describe.service.impl;
2   
3   import org.junit.Test;
4   import org.kuali.ole.OleEditorResponseHandler;
5   import org.kuali.ole.describe.service.OleWebServiceProvider;
6   import org.kuali.ole.pojo.OleBibRecord;
7   import org.kuali.ole.pojo.OleEditorResponse;
8   import org.kuali.ole.select.service.OleExposedWebService;
9   import org.kuali.ole.select.service.impl.OleExposedWebServiceImpl;
10  import org.kuali.rice.core.api.config.property.ConfigContext;
11  
12  import java.util.HashMap;
13  
14  import static junit.framework.Assert.fail;
15  
16  /**
17   * Created by IntelliJ IDEA.
18   * User: pvsubrah
19   * Date: 4/15/12
20   * Time: 10:45 AM
21   * To change this template use File | Settings | File Templates.
22   */
23  public class OleWebServiceProviderImpl_UT {
24      private String editorResponseXMLForOLE;
25  
26      @Test
27      public void testGetService() {
28          OleWebServiceProvider oleWebServiceProvider = new OleWebServiceProviderImpl();
29          OleExposedWebService oleExposedWebService = new OleExposedWebServiceImpl();
30  
31          OleEditorResponse oleEditorResponse = new OleEditorResponse();
32          OleBibRecord oleBibRecord = new OleBibRecord();
33          oleBibRecord.setBibUUID("12324235");
34          oleBibRecord.setLinkedInstanceId("12252qwd253");
35          HashMap bibAssociatedFieldsValueMap = new HashMap();
36          bibAssociatedFieldsValueMap.put("title_search", "mockTitle");
37          bibAssociatedFieldsValueMap.put("author_display", "mockAuthor");
38          oleBibRecord.setBibAssociatedFieldsValueMap(bibAssociatedFieldsValueMap);
39          oleEditorResponse.setOleBibRecord(oleBibRecord);
40          oleEditorResponse.setTokenId("1234");
41  
42          editorResponseXMLForOLE = new OleEditorResponseHandler().toXML(oleEditorResponse);
43  
44          try {
45              oleExposedWebService.addDoctoreResponse(editorResponseXMLForOLE);
46          } catch (Exception e) {
47              System.out.println(e.getMessage());
48              fail();
49          }
50          System.out.println("successfully sent message to OLE with the Editor response");
51  
52      }
53  
54      public String getURL() {
55          String url = ConfigContext.getCurrentContextConfig().getProperty("oleExposedWebService.url");
56          return url;
57      }
58  }