Package org.apache.axis2.jaxws.spi

Examples of org.apache.axis2.jaxws.spi.ServiceDelegate


*/
public class WSDLTests extends TestCase {
   
    public void testValidWSDLService() {
        Service service = null;
        ServiceDelegate serviceDelegate = null;
        String namespaceURI= "http://ws.apache.org/axis2/tests";
        String localPart = "EchoService";
        URL wsdlURL = DescriptionTestUtils2.getWSDLURL();
        assertNotNull(wsdlURL);
        service = Service.create(wsdlURL, new QName(namespaceURI, localPart));
        assertNotNull("Service not created", service);

        serviceDelegate = DescriptionTestUtils2.getServiceDelegate(service);
        assertNotNull("ServiceDelegate not created", serviceDelegate);
       
        ServiceDescription serviceDescription = serviceDelegate.getServiceDescription();
        assertNotNull("ServiceDescription not created", serviceDescription);
       
//        AxisService axisService = serviceDescription.getAxisService();
//        assertNotNull("AxisService not created", axisService);
    }
View Full Code Here


            assertNotNull(genSvc);
            ClientMetadataPortSEI port = genSvc.getPort(ClientMetadataPortSEI.class);
            assertNotNull(port);
           
            // User internal state to verify the port information before and after the close
            ServiceDelegate delegate = DescriptionTestUtils2.getServiceDelegate(genSvc);
            ServiceDescription svcDesc = delegate.getServiceDescription();
            EndpointDescription[] epDescArray= svcDesc.getEndpointDescriptions();
            assertNotNull(epDescArray);
            assertEquals(1, epDescArray.length);
           
            AxisConfiguration axisConfig = svcDesc.getAxisConfigContext().getAxisConfiguration();
View Full Code Here

           
            // Verify that things are as expected and save off information for later asserts
            // after the closes.
           
            // Make sure all the Service Delegates are unique.
            ServiceDelegate sd1 = DescriptionTestUtils2.getServiceDelegate(svc1);
            ServiceDelegate sd2 = DescriptionTestUtils2.getServiceDelegate(svc2);
            ServiceDelegate sd3 = DescriptionTestUtils2.getServiceDelegate(svc3);
            assertNotSame(sd1, sd2);
            assertNotSame(sd2, sd3);
            assertNotSame(sd1, sd3);
           
            // Make sure the ServiceDescription is shared across the delegate instances.
            ServiceDescription svcDesc1 = sd1.getServiceDescription();
            ServiceDescription svcDesc2 = sd2.getServiceDescription();
            ServiceDescription svcDesc3 = sd3.getServiceDescription();
            AxisConfiguration axisConfig = svcDesc1.getAxisConfigContext().getAxisConfiguration();
            assertSame(svcDesc1, svcDesc2);
            assertSame(svcDesc1, svcDesc3);
            // Since the services descriptions are shared, use this in the rest of the test for clarity
            ServiceDescription svcDesc = svcDesc1;
           
            // Make sure the endpoint descriptions for the same ports are shared across the
            // delegate instances
           
            EndpointDescription epDesc1_port1 = svcDesc.getEndpointDescription(portQN1, sd1);
            EndpointDescription epDesc2_port1 = svcDesc.getEndpointDescription(portQN1, sd2);
            assertSame(epDesc1_port1, epDesc2_port1);
            AxisService axisSvc1_port1 = epDesc1_port1.getAxisService();
            AxisService axisSvc2_port1 = epDesc2_port1.getAxisService();
            assertSame(axisSvc1_port1, axisSvc2_port1);
            AxisService portQN1_AxisService = axisSvc1_port1;
            AxisService portQN3_AxisService = svcDesc.getEndpointDescription(portQN3, sd1).getAxisService();
            assertNull(svcDesc.getEndpointDescription(portQN1, sd3));
           
            EndpointDescription epDesc1_port2 = svcDesc.getEndpointDescription(portQN2, sd1);
            EndpointDescription epDesc2_port2 = svcDesc.getEndpointDescription(portQN2, sd2);
            assertSame(epDesc1_port2, epDesc2_port2);
            AxisService axisSvc1_port2 = epDesc1_port2.getAxisService();
            AxisService axisSvc2_port2 = epDesc2_port2.getAxisService();
            assertSame(axisSvc1_port2, axisSvc2_port2);
            AxisService portQN2_AxisService = axisSvc1_port2;
           
            EndpointDescription epDesc3_port4 = svcDesc.getEndpointDescription(portQN4, sd3);
            assertNotNull(epDesc3_port4);
            AxisService portQN4_AxisService = epDesc3_port4.getAxisService();
           
            // Make sure all the AxisServices we expect exist.  When the resoureces associated
            // with a port are release below after the closes, the AxisServices are released.
            assertTrue(axisConfig.getServiceGroup(portQN1_AxisService.getAxisServiceGroup().getServiceGroupName()) != null);
            assertTrue(axisConfig.getServiceGroup(portQN2_AxisService.getAxisServiceGroup().getServiceGroupName()) != null);
            assertTrue(axisConfig.getServiceGroup(portQN3_AxisService.getAxisServiceGroup().getServiceGroupName()) != null);
            assertTrue(axisConfig.getServiceGroup(portQN4_AxisService.getAxisServiceGroup().getServiceGroupName()) != null);

            // First close
            org.apache.axis2.jaxws.spi.ServiceDelegate.releaseService(svc1);
            // Should remove the entries for this delegate
            assertNull(svcDesc.getEndpointDescription(portQN1, sd1));
            assertNull(svcDesc.getEndpointDescription(portQN2, sd1));
            // Should only release port 3 since 1 and 2 are shared and 4 wasn't added to this delegate
            assertTrue(axisConfig.getServiceGroup(portQN1_AxisService.getAxisServiceGroup().getServiceGroupName()) != null);
            assertTrue(axisConfig.getServiceGroup(portQN2_AxisService.getAxisServiceGroup().getServiceGroupName()) != null);
            assertTrue(axisConfig.getServiceGroup(portQN3_AxisService.getAxisServiceGroup().getServiceGroupName()) == null);
            assertTrue(axisConfig.getServiceGroup(portQN4_AxisService.getAxisServiceGroup().getServiceGroupName()) != null);
           
            // Make sure the close didn't change anything unexpected
            ServiceDescription svcDesc2_afterClose = sd2.getServiceDescription();
            assertSame(svcDesc2, svcDesc2_afterClose);
            EndpointDescription epDesc2_port1_afterClose =
                svcDesc2_afterClose.getEndpointDescription(portQN1, sd2);
            assertSame(epDesc2_port1, epDesc2_port1_afterClose);
            EndpointDescription epDesc2_port2_afterClose =
                svcDesc2_afterClose.getEndpointDescription(portQN2, sd2);
            assertSame(epDesc2_port2, epDesc2_port2_afterClose);
           
            // Second close.
            // This should remove all entries for this delegate
            // This should cause ports 1 and 2 to be released as both service 1 and 2 that were
            // using them are now closed.  Service 4 should be unaffected
            org.apache.axis2.jaxws.spi.ServiceDelegate.releaseService(svc2);
            assertNull(svcDesc.getEndpointDescription(portQN1, sd2));
            assertNull(svcDesc.getEndpointDescription(portQN2, sd2));
            assertNull(svcDesc.getEndpointDescription(portQN4, sd2));

            assertTrue(axisConfig.getServiceGroup(portQN1_AxisService.getAxisServiceGroup().getServiceGroupName()) == null);
            assertTrue(axisConfig.getServiceGroup(portQN2_AxisService.getAxisServiceGroup().getServiceGroupName()) == null);
            assertTrue(axisConfig.getServiceGroup(portQN3_AxisService.getAxisServiceGroup().getServiceGroupName()) == null);
            assertTrue(axisConfig.getServiceGroup(portQN4_AxisService.getAxisServiceGroup().getServiceGroupName()) != null);

            // Make sure the close didn't change anything unexpected
            ServiceDescription svcDesc3_afterClose = sd3.getServiceDescription();
            assertSame(svcDesc3_afterClose, svcDesc3);

            // Close the last delegate then verify all the services have been removed
            // from the AxisConfiguration
            org.apache.axis2.jaxws.spi.ServiceDelegate.releaseService(svc3);
View Full Code Here

        QName validPortQName = new QName(namespaceURI, "EchoPort");
        EchoPort echoPort = service.getPort(validPortQName, EchoPort.class);
        assertNotNull(echoPort);
       
        BindingProvider bindingProvider = (BindingProvider)Proxy.getInvocationHandler(echoPort);
        ServiceDelegate serviceDelegate = bindingProvider.getServiceDelegate();
        assertNotNull(serviceDelegate);
        EndpointDescription endpointDesc = bindingProvider.getEndpointDescription();
        assertNotNull(endpointDesc);
        AxisService axisService = endpointDesc.getAxisService();
        assertNotNull(axisService);
View Full Code Here

        QName validPortQName = new QName(namespaceURI, "EchoPort");
        Dispatch<String> dispatch = service.createDispatch(validPortQName, String.class, null);
        assertNotNull(dispatch);
       
        BindingProvider bindingProvider = (BindingProvider) dispatch;
        ServiceDelegate serviceDelegate = bindingProvider.getServiceDelegate();
        assertNotNull(serviceDelegate);
        EndpointDescription endpointDesc = bindingProvider.getEndpointDescription();
        assertNotNull(endpointDesc);
        AxisService axisService = endpointDesc.getAxisService();
        assertNotNull(axisService);
View Full Code Here

        service.addPort(validPortQName, null, null);
        Dispatch<String> dispatch = service.createDispatch(validPortQName, String.class, null);
        assertNotNull(dispatch);
       
        BindingProvider bindingProvider = (BindingProvider) dispatch;
        ServiceDelegate serviceDelegate = bindingProvider.getServiceDelegate();
        assertNotNull(serviceDelegate);
        EndpointDescription endpointDesc = bindingProvider.getEndpointDescription();
        assertNotNull(endpointDesc);
        AxisService axisService = endpointDesc.getAxisService();
        assertNotNull(axisService);
View Full Code Here

        QName validPortQName = new QName(namespaceURI, "EchoPort");
        EchoPort echoPort = service.getPort(validPortQName, EchoPort.class);
        assertNotNull(echoPort);
       
        BindingProvider bindingProvider = (BindingProvider)Proxy.getInvocationHandler(echoPort);
        ServiceDelegate serviceDelegate = bindingProvider.getServiceDelegate();
        assertNotNull(serviceDelegate);
        EndpointDescription endpointDesc = bindingProvider.getEndpointDescription();
        assertNotNull(endpointDesc);
        AxisService axisService = endpointDesc.getAxisService();
        assertNotNull(axisService);
View Full Code Here

        EchoPort echoPort = service.getPort(validPortQName, EchoPort.class);
        Dispatch<String> dispatch = service.createDispatch(validPortQName, String.class, null);
        assertNotNull(dispatch);
       
        BindingProvider bindingProvider = (BindingProvider) dispatch;
        ServiceDelegate serviceDelegate = bindingProvider.getServiceDelegate();
        assertNotNull(serviceDelegate);
        EndpointDescription endpointDesc = bindingProvider.getEndpointDescription();
        assertNotNull(endpointDesc);
        AxisService axisService = endpointDesc.getAxisService();
        assertNotNull(axisService);
View Full Code Here

        service.addPort(validPortQName, null, null);
        Dispatch<String> dispatch = service.createDispatch(validPortQName, String.class, null);
        assertNotNull(dispatch);
       
        BindingProvider bindingProvider = (BindingProvider) dispatch;
        ServiceDelegate serviceDelegate = bindingProvider.getServiceDelegate();
        assertNotNull(serviceDelegate);
        EndpointDescription endpointDesc = bindingProvider.getEndpointDescription();
        assertNotNull(endpointDesc);
        AxisService axisService = endpointDesc.getAxisService();
        assertNotNull(axisService);
View Full Code Here

        return wsdlDefinition;
    }

    static public ServiceDelegate getServiceDelegate(Service service) {
        // Need to get to the private Service._delegate field in order to get to the ServiceDescription to test
        ServiceDelegate returnServiceDelegate = null;
        try {
            try {
//                Field serviceDelgateField = service.getClass().getDeclaredFields()[0];
                Field serviceDelgateField = service.getClass().getDeclaredField("delegate");
                serviceDelgateField.setAccessible(true);
View Full Code Here

TOP

Related Classes of org.apache.axis2.jaxws.spi.ServiceDelegate

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.