View Javadoc

1   package org.kuali.ole.editor.service.impl;
2   
3   import org.junit.Test;
4   import org.kuali.ole.OleBaseTestCase;
5   import org.kuali.ole.OleEditorResponseHandler;
6   import org.kuali.ole.PropertyUtil;
7   import org.kuali.ole.editor.service.OleExposedWebService;
8   import org.kuali.ole.editor.service.OleWebServiceProvider;
9   import org.kuali.ole.pojo.OleBibRecord;
10  import org.kuali.ole.pojo.OleEditorResponse;
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 extends OleBaseTestCase {
24      private String editorResponseXMLForOLE;
25  
26      @Test
27      public void testGetService() {
28          OleWebServiceProvider oleWebServiceProvider = new OleWebServiceProviderImpl();
29          OleExposedWebService oleExposedWebService =
30                  (OleExposedWebService) oleWebServiceProvider.
31                          getService("org.kuali.ole.editor.service.OleExposedWebService", "oleExposedWebService", getURL());
32  
33          OleEditorResponse oleEditorResponse = new OleEditorResponse();
34          OleBibRecord oleBibRecord = new OleBibRecord();
35          oleBibRecord.setBibUUID("12324235");
36          oleBibRecord.setLinkedInstanceId("12252qwd253");
37          HashMap bibAssociatedFieldsValueMap = new HashMap();
38          bibAssociatedFieldsValueMap.put("title_search", "mockTitle");
39          bibAssociatedFieldsValueMap.put("author_display", "mockAuthor");
40          oleBibRecord.setBibAssociatedFieldsValueMap(bibAssociatedFieldsValueMap);
41          oleEditorResponse.setOleBibRecord(oleBibRecord);
42          oleEditorResponse.setTokenId("1234");
43  
44          editorResponseXMLForOLE = new OleEditorResponseHandler().toXML(oleEditorResponse);
45  
46          try {
47              oleExposedWebService.addDoctoreResponse(editorResponseXMLForOLE);
48          } catch (Exception e) {
49              System.out.println(e.getMessage());
50              fail();
51          }
52          System.out.println("successfully sent message to OLE with the Editor response");
53  
54      }
55  
56      public String getURL() {
57          String url = PropertyUtil.getPropertyUtil().getProperty("oleExposedWebService.url");
58          return url;
59      }
60  }