Package org.apache.axis2.jaxws.spi

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


        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];
                serviceDelgateField.setAccessible(true);
                returnServiceDelegate = (ServiceDelegate) serviceDelgateField.get(service);
View Full Code Here


     */
    public void testCreateService() {
        String namespaceURI= "http://ws.apache.org/axis2/tests";
        String localPart = "EchoServiceAnnotated";
        Service service = Service.create(null,  new QName(namespaceURI, localPart));
        ServiceDelegate serviceDelegate = DescriptionTestUtils2.getServiceDelegate(service);
        ServiceDescription serviceDescription = serviceDelegate.getServiceDescription();
        String portLocalPart = "EchoServiceAnnotatedPort";
        QName portQName = new QName(namespaceURI, portLocalPart);
        DocumentLiteralWrappedProxy dlwp = service.getPort(portQName, DocumentLiteralWrappedProxy.class);
       
        // Validate that the Endpoint and EndpointInterface Descriptions were created correctly
View Full Code Here

            ClientMetadataTest.installCachingFactory();
            QName svcQN = new QName(namespaceURI, svcLocalPart);
           
            Service svc1 = Service.create(svcQN);
            assertNotNull(svc1);
            ServiceDelegate svcDlg1 = DescriptionTestUtils2.getServiceDelegate(svc1);
            assertNotNull(svcDlg1);
            ServiceDescription svcDesc1 = svcDlg1.getServiceDescription();
            assertNotNull(svcDesc1);

            Service svc2 = Service.create(svcQN);
            assertNotNull(svc2);
            ServiceDelegate svcDlg2 = DescriptionTestUtils2.getServiceDelegate(svc2);
            assertNotNull(svcDlg2);
            ServiceDescription svcDesc2 = svcDlg2.getServiceDescription();
            assertNotNull(svcDesc2);
           
            assertNotSame("Service instances should not be the same", svc1, svc2);
            assertNotSame("Service delegates should not be the same", svcDlg1, svcDlg2);
            assertSame("Instance of ServiceDescription should be the same", svcDesc1, svcDesc2);
View Full Code Here

            Service svc1 = Service.create(svcQN);
            QName portQN = new QName(namespaceURI, dynamicPort1);
            svc1.addPort(portQN, bindingID1, epr1);

            // User internal state to verify the port information before and after the close
            ServiceDelegate delegate = DescriptionTestUtils2.getServiceDelegate(svc1);
            ServiceDescription svcDesc = delegate.getServiceDescription();
            EndpointDescription epDesc= svcDesc.getEndpointDescription(portQN, delegate);
            assertNotNull(epDesc);
            AxisConfiguration axisConfig = svcDesc.getAxisConfigContext().getAxisConfiguration();
            HashMap axisServices = axisConfig.getServices();
            assertEquals(1, axisServices.size());
View Full Code Here

            Service svc1 = Service.create(svcQN);
            QName portQN = new QName(namespaceURI, dynamicPort1);
            svc1.addPort(portQN, bindingID1, epr1);

            // Use internal state to verify all is well
            ServiceDelegate delegate1 = DescriptionTestUtils2.getServiceDelegate(svc1);
            ServiceDescription svcDesc1 = delegate1.getServiceDescription();
            assertNotNull(svcDesc1);
            EndpointDescription epDesc1= svcDesc1.getEndpointDescription(portQN, delegate1);
            assertNotNull(epDesc1);
            AxisService axisService1 = epDesc1.getAxisService();
            assertNotNull(axisService1);
            AxisConfiguration axisConfig1 = svcDesc1.getAxisConfigContext().getAxisConfiguration();
            HashMap axisServices1 = axisConfig1.getServices();
            assertEquals(1, axisServices1.size());

            // Close the delegate, which should release resources and remove objects from caches
            org.apache.axis2.jaxws.spi.ServiceDelegate.releaseService(svc1);
           
            Service svc2 = Service.create(svcQN);
            svc2.addPort(portQN, bindingID1, epr1);

            // Use internal state to verify all is well; compare to values from the first time
            // around to make sure the cache values for things like the ServiceDescription got
            // cleared out when the last ServiceDelegate (in the test the only one) relesaed
            // the resources.
            ServiceDelegate delegate2 = DescriptionTestUtils2.getServiceDelegate(svc2);
            assertNotSame(delegate1, delegate2);
            ServiceDescription svcDesc2 = delegate2.getServiceDescription();
            assertNotNull(svcDesc2);
            assertNotSame(svcDesc1, svcDesc2);
            EndpointDescription epDesc2= svcDesc2.getEndpointDescription(portQN, delegate2);
            assertNotNull(epDesc2);
            assertNotSame(epDesc1, epDesc2);
View Full Code Here

            svc1.addPort(portQN2, bindingID1, epr1);

            svc2.addPort(portQN1,bindingID1, epr1);
            svc2.addPort(portQN2, bindingID1, epr1);
           
            ServiceDelegate sd1 = DescriptionTestUtils2.getServiceDelegate(svc1);
            ServiceDelegate sd2 = DescriptionTestUtils2.getServiceDelegate(svc2);
            assertNotSame(sd1, sd2);
           
            ServiceDescription svcDesc1 = sd1.getServiceDescription();
            ServiceDescription svcDesc2 = sd2.getServiceDescription();
            AxisConfiguration axisConfig = svcDesc1.getAxisConfigContext().getAxisConfiguration();
            assertSame(svcDesc1, svcDesc2);
           
            EndpointDescription epDesc1_port1 = svcDesc1.getEndpointDescription(portQN1, sd1);
            EndpointDescription epDesc2_port1 = svcDesc1.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);

            EndpointDescription epDesc1_port2 = svcDesc1.getEndpointDescription(portQN2, sd1);
            EndpointDescription epDesc2_port2 = svcDesc1.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);

            // First close should NOT cleanup the endpoints since the other service is
            // still using them.
            org.apache.axis2.jaxws.spi.ServiceDelegate.releaseService(svc1);
           
            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);
           
            // Add a third, should use the same
            Service svc3 = Service.create(svcQN);
            svc3.addPort(portQN1,bindingID1, epr1);
            svc3.addPort(portQN2, bindingID1, epr1);
            ServiceDelegate sd3 = DescriptionTestUtils2.getServiceDelegate(svc3);
            assertNotSame(sd2, sd3);
            ServiceDescription svcDesc3 = sd3.getServiceDescription();
            assertSame(svcDesc2_afterClose, svcDesc3);
            EndpointDescription epDesc3_port1 = svcDesc3.getEndpointDescription(portQN1, sd3);
            assertSame(epDesc3_port1, epDesc2_port1_afterClose);
            EndpointDescription epDesc3_port2 = svcDesc3.getEndpointDescription(portQN2, sd3);
            assertSame(epDesc3_port2, epDesc2_port2_afterClose);

            // Close the 2nd delegate and make sure cahced objects are still there
            // since there's a 3rd delegate now
            org.apache.axis2.jaxws.spi.ServiceDelegate.releaseService(svc2);

            ServiceDescription svcDesc3_afterClose = sd3.getServiceDescription();
            assertSame(svcDesc3, svcDesc3_afterClose);
            EndpointDescription epDesc3_port1_afterClose =
                svcDesc3_afterClose.getEndpointDescription(portQN1, sd3);
            assertSame(epDesc3_port1, epDesc3_port1_afterClose);
            EndpointDescription epDesc3_port2_afterClose =
View Full Code Here

            ClientMetadataPortSEI svc2_port1 = svc2.getPort(portQN1, ClientMetadataPortSEI.class);
            ClientMetadataPortSEI svc2_port2 = svc2.getPort(portQN2, ClientMetadataPortSEI.class);
            ClientMetadataPortSEI svc2_port3 = svc2.getPort(portQN3, ClientMetadataPortSEI.class);

            ServiceDelegate sd1 = DescriptionTestUtils2.getServiceDelegate(svc1);
            ServiceDelegate sd2 = DescriptionTestUtils2.getServiceDelegate(svc2);
            assertNotSame(sd1, sd2);

            ServiceDescription svcDesc1 = sd1.getServiceDescription();
            ServiceDescription svcDesc2 = sd2.getServiceDescription();
            AxisConfiguration axisConfig = svcDesc1.getAxisConfigContext().getAxisConfiguration();
            assertSame(svcDesc1, svcDesc2);
           
            EndpointDescription epDesc1_port1 = svcDesc1.getEndpointDescription(portQN1, sd1);
            EndpointDescription epDesc2_port1 = svcDesc1.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);

            EndpointDescription epDesc1_port2 = svcDesc1.getEndpointDescription(portQN2, sd1);
            EndpointDescription epDesc2_port2 = svcDesc1.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);

            // First close should NOT cleanup the endpoints since the other service is
            // still using them.
            org.apache.axis2.jaxws.spi.ServiceDelegate.releaseService(svc1);
           
            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);

            // Add a third, should use the same
            Service svc3 = Service.create(wsdlUrl, serviceQName);
            ClientMetadataPortSEI svc3_port1 = svc3.getPort(portQN1, ClientMetadataPortSEI.class);
            ClientMetadataPortSEI svc3_port2 = svc3.getPort(portQN2, ClientMetadataPortSEI.class);
            ServiceDelegate sd3 = DescriptionTestUtils2.getServiceDelegate(svc3);
            assertNotSame(sd2, sd3);
            ServiceDescription svcDesc3 = sd3.getServiceDescription();
            assertSame(svcDesc2_afterClose, svcDesc3);
            EndpointDescription epDesc3_port1 = svcDesc3.getEndpointDescription(portQN1, sd3);
            assertSame(epDesc3_port1, epDesc2_port1_afterClose);
            EndpointDescription epDesc3_port2 = svcDesc3.getEndpointDescription(portQN2, sd3);
            assertSame(epDesc3_port2, epDesc2_port2_afterClose);

            // Close the 2nd delegate and make sure cahced objects are still there
            // since there's a 3rd delegate now
            org.apache.axis2.jaxws.spi.ServiceDelegate.releaseService(svc2);

            ServiceDescription svcDesc3_afterClose = sd3.getServiceDescription();
            assertSame(svcDesc3, svcDesc3_afterClose);
            EndpointDescription epDesc3_port1_afterClose =
                svcDesc3_afterClose.getEndpointDescription(portQN1, sd3);
            assertSame(epDesc3_port1, epDesc3_port1_afterClose);
            EndpointDescription epDesc3_port2_afterClose =
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

            ClientMetadataTest.installCachingFactory();
            QName svcQN = new QName(namespaceURI, svcLocalPart);
           
            Service svc1 = Service.create(svcQN);
            assertNotNull(svc1);
            ServiceDelegate svcDlg1 = DescriptionTestUtils2.getServiceDelegate(svc1);
            assertNotNull(svcDlg1);
            ServiceDescription svcDesc1 = svcDlg1.getServiceDescription();
            assertNotNull(svcDesc1);

            Service svc2 = Service.create(svcQN);
            assertNotNull(svc2);
            ServiceDelegate svcDlg2 = DescriptionTestUtils2.getServiceDelegate(svc2);
            assertNotNull(svcDlg2);
            ServiceDescription svcDesc2 = svcDlg2.getServiceDescription();
            assertNotNull(svcDesc2);
           
            assertNotSame("Service instances should not be the same", svc1, svc2);
            assertNotSame("Service delegates should not be the same", svcDlg1, svcDlg2);
            assertSame("Instance of ServiceDescription should be the same", svcDesc1, svcDesc2);
View Full Code Here

        OperationDescription expectedOperationDescription = endpointInterfaceDescription.getOperation(operationQName)[0];
        return expectedOperationDescription;
    }
   
    private void setAxisConfigParameter(Service service, String key, String value) {
        ServiceDelegate delegate = DescriptionTestUtils2.getServiceDelegate(service);
        ServiceDescription svcDesc = delegate.getServiceDescription();
        AxisConfiguration axisConfig = svcDesc.getAxisConfigContext().getAxisConfiguration();
        Parameter parameter = new Parameter(key, value);
        try {
            axisConfig.addParameter(parameter);
        } catch (AxisFault e) {
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.