summaryrefslogtreecommitdiffstats
path: root/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ReferenceTestCase.java
blob: 2ce23bf2c421b84d3acc2e2d1e0131184d9e7571 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 * 
 *   http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.    
 */
package org.apache.tuscany.sca.binding.ws.axis2;

import junit.framework.TestCase;

public class Axis2ReferenceTestCase extends TestCase {

    public void testInvokeService() throws Exception {
//        Axis2ReferenceBinding axis2Reference = createAxis2Reference("testWebAppName", "testServiceName");
//        ServiceContract contract = new JavaServiceContract();
//        Operation operation = new Operation<Type>("sayHi", null, null, null, false, null, NO_CONVERSATION);
//        TargetInvoker targetInvoker = axis2Reference.createTargetInvoker(contract, operation);
//        assertNotNull(targetInvoker);
//        assertFalse(targetInvoker instanceof Axis2AsyncTargetInvoker);
    }

    public void testAsyncTargetInvoker() throws Exception {
//        Axis2ReferenceBinding axis2Reference = createAxis2Reference("testWebAppName", "testServiceName");
//        //Create a mocked InboundWire, make the call of ServiceBindingExtension.getInterface() returns a Class
//        Wire inboundWire = EasyMock.createNiceMock(Wire.class);
//        JavaServiceContract contract = new JavaServiceContract(Greeter.class);
//        contract.setCallbackName("");
//        contract.setCallbackClass(GreetingCallback.class);
//        Operation<Type> callbackOp =
//            new Operation<Type>("sayHiCallback", null, null, null, true, null, NO_CONVERSATION);
//        HashMap<String, Operation<Type>> callbackOps = new HashMap<String, Operation<Type>>();
//        callbackOps.put("sayHiCallback", callbackOp);
//        contract.setCallbackOperations(callbackOps);
//        EasyMock.expect(inboundWire.getTargetContract()).andReturn(contract).anyTimes();
//        EasyMock.replay(inboundWire);
//
//        axis2Reference.setWire(inboundWire);
//        Operation operation = new Operation<Type>("sayHi", null, null, null, true, null, NO_CONVERSATION);
//        TargetInvoker asyncTargetInvoker = axis2Reference.createTargetInvoker(contract, operation);
//        assertNotNull(asyncTargetInvoker);
//        assertTrue(asyncTargetInvoker instanceof Axis2AsyncTargetInvoker);
    }

//    @SuppressWarnings("unchecked")
//    private Axis2ReferenceBinding createAxis2Reference(String webAppName, String serviceName) throws Exception {
//        //Create WebServiceBindingDefinition
//        String wsdlLocation = "/wsdl/hello_world_doc_lit.wsdl";
//        URL url = getClass().getResource(wsdlLocation);
//        assertNotNull("Could not find wsdl " + url.toString(), url);
//
//        WSDLFactory factory = WSDLFactory.newInstance();
//        WSDLReader reader = factory.newWSDLReader();
//        reader.setFeature("javax.wsdl.verbose", false);
//        InputSource input = new InputSource(url.openStream());
//        Definition wsdlDef = reader.readWSDL(url.toString(), input);
//        Service wsdlService = wsdlDef.getService(new QName("http://objectweb.org/hello_world_soap_http",
//            "SOAPService"));
//        Port port = wsdlService.getPort("SoapPort");
//        WebServiceBindingDefinition wsBinding =
//            new WebServiceBindingDefinition(wsdlDef, port, "uri", "portURI", wsdlService);
//        //Create a mocked WireService, make the call of ServiceBindingExtension.getServiceInstance() returns a proxy instance.
//        // TODO figure out what to do with the service contract
//        ServiceContract<?> contract = new WSDLServiceContract();
//        contract.setInterfaceClass(Greeter.class);
//        return new Axis2ReferenceBinding(URI.create(serviceName),
//            wsBinding,
//            contract,
//            null,
//            null);
//    }
}