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.Before;
6 import org.junit.Test;
7 import org.kuali.ole.RepositoryManager;
8 import org.kuali.ole.base.BaseTestCase;
9 import org.kuali.rice.core.api.config.property.ConfigContext;
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 javax.jcr.Node;
17 import javax.jcr.NodeIterator;
18 import javax.jcr.Session;
19 import javax.xml.namespace.QName;
20
21
22
23
24
25
26
27
28 public class OleUuidCheckWebservice_UT extends BaseTestCase {
29
30
31 @Mock
32 public ConfigContext mockconfigContext;
33
34
35 @Before
36 public void setUp() throws Exception {
37 super.setUp();
38 MockitoAnnotations.initMocks(this);
39
40 }
41
42 private static final Logger LOG = LoggerFactory.getLogger(OleUuidCheckWebservice_UT.class);
43 ClientProxyFactoryBean clientFactory;
44
45 @Test
46 public void testUuidCheck() {
47
48 OleUuidCheckWebService oleUuidCheckWebService = (OleUuidCheckWebService) getService();
49 try{
50 String exist = oleUuidCheckWebService.checkUuidExsistence("3f9ba69e-24ac-4737-9a4b-6e4b9a6d14c,bef35848-82e2-4af1-9c7b-e66443efaa1");
51 LOG.info(" exist " + exist);
52 }
53 catch (Exception e)
54 {
55 LOG.info("OLE Server down..." + e);
56 }
57 }
58
59 public Object getService() {
60 try {
61 clientFactory = new JaxWsProxyFactoryBean();
62 clientFactory.setServiceClass(Class.forName("org.kuali.ole.service.OleUuidCheckWebService"));
63
64 } catch (ClassNotFoundException e) {
65 LOG.error("Failed to connect to soap service because failed to load interface class: ", e);
66 }
67 QName namespaceURI = new QName("http://service.select.ole.kuali.org/", "oleUuidCheckWebService");
68 clientFactory.setServiceName(namespaceURI);
69 String serviceURL = "";
70 LOG.info(" uuidCheckServiceURL --------> " + serviceURL);
71 clientFactory.setAddress(serviceURL);
72 Object service = clientFactory.create();
73 LOG.info("<<<< service >>>> " + service);
74 return service;
75
76 }
77 }