1 package org.kuali.ole.service;
2
3 import org.apache.cxf.frontend.ClientProxyFactoryBean;
4 import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
5 import org.junit.Test;
6 import org.kuali.ole.base.BaseTestCase;
7 import org.kuali.ole.service.OleUuidCheckWebService;
8 import org.kuali.ole.docstore.util.PropertyUtil;
9 import org.slf4j.Logger;
10 import org.slf4j.LoggerFactory;
11
12 import javax.xml.namespace.QName;
13
14
15
16
17
18
19
20
21 public class OleUuidCheckWebservice_UT extends BaseTestCase {
22
23 private static final Logger LOG = LoggerFactory.getLogger(OleUuidCheckWebservice_UT.class);
24 ClientProxyFactoryBean clientFactory;
25
26 @Test
27 public void testUuidCheck() {
28
29 OleUuidCheckWebService oleUuidCheckWebService = (OleUuidCheckWebService) getService();
30 try{
31 String exist = oleUuidCheckWebService.checkUuidExsistence("3f9ba69e-24ac-4737-9a4b-6e4b9a6d14c,bef35848-82e2-4af1-9c7b-e66443efaa1");
32 LOG.info(" exist " + exist);
33 }
34 catch (Exception e)
35 {
36 LOG.info("OLE Server down...");
37 }
38 }
39
40 public Object getService() {
41 try {
42 clientFactory = new JaxWsProxyFactoryBean();
43 clientFactory.setServiceClass(Class.forName("org.kuali.ole.service.OleUuidCheckWebService"));
44
45 } catch (ClassNotFoundException e) {
46 LOG.error("Failed to connect to soap service because failed to load interface class: ", e);
47 }
48 QName namespaceURI = new QName("http://service.select.ole.kuali.org/", "oleUuidCheckWebService");
49 clientFactory.setServiceName(namespaceURI);
50 String serviceURL = PropertyUtil.getPropertyUtil().getProperty("uuidCheckServiceURL");
51 LOG.info(" uuidCheckServiceURL --------> " + serviceURL);
52 clientFactory.setAddress(serviceURL);
53 Object service = clientFactory.create();
54 LOG.info("<<<< service >>>> " + service);
55 return service;
56
57 }
58 }