Added: webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/impl/ClientDBCSupportEndpointTests.java URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/impl/ClientDBCSupportEndpointTests.java?rev=611042&view=auto ============================================================================== --- webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/impl/ClientDBCSupportEndpointTests.java (added) +++ webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/impl/ClientDBCSupportEndpointTests.java Thu Jan 10 19:56:14 2008 @@ -0,0 +1,307 @@ +/* + * 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.axis2.jaxws.description.impl; + +import org.apache.axis2.jaxws.description.DescriptionFactory; +import org.apache.axis2.jaxws.description.EndpointDescription; +import org.apache.axis2.jaxws.description.ServiceDescription; +import org.apache.axis2.jaxws.description.builder.DescriptionBuilderComposite; + +import javax.jws.WebService; +import javax.xml.namespace.QName; +import javax.xml.ws.Holder; +import javax.xml.ws.Service; +import javax.xml.ws.WebServiceClient; +import javax.xml.ws.WebServiceException; + +import java.io.File; +import java.net.MalformedURLException; +import java.net.URL; + +import junit.framework.TestCase; + +/** + * Test client sparse composite support in the MDQ layer at the Endpoint creation level. + */ +/** + * + */ +public class ClientDBCSupportEndpointTests extends TestCase { + private String namespaceURI = "http://org.apache.axis2.jaxws.description.impl.ClientDBCSupportEndpointTests"; + private String svcLocalPart = "svcLocalPart"; + private String portLocalPart = "portLocalPart"; + + /** + * Verify that the code that doesn't use a composite continues to work correctly. + */ + public void testPreDBCFunctionality() { + QName serviceQName = new QName(namespaceURI, svcLocalPart); + + ServiceDescription svcDesc = DescriptionFactory.createServiceDescription(null, serviceQName, ClientDBCSupportEndpointServiceSubclass.class); + assertNotNull(svcDesc); + ServiceDescriptionImpl svcDescImpl = (ServiceDescriptionImpl) svcDesc; + DescriptionBuilderComposite svcDescComposite = svcDescImpl.getDescriptionBuilderComposite(); + assertNotNull(svcDescComposite); + + Class testServiceClass = svcDescComposite.getCorrespondingClass(); + assertNotNull(testServiceClass); + assertEquals(ClientDBCSupportEndpointServiceSubclass.class, testServiceClass); + + // Now update with an SEI + QName portQName = new QName(namespaceURI, portLocalPart); + EndpointDescription epDesc = + DescriptionFactory.updateEndpoint(svcDesc, ClientDBCSupportEndpointSEI.class, portQName, DescriptionFactory.UpdateType.GET_PORT); + assertNotNull(epDesc); + EndpointDescriptionImpl epDescImpl = (EndpointDescriptionImpl) epDesc; + DescriptionBuilderComposite epDescComposite = epDescImpl.getDescriptionBuilderComposite(); + Class seiClass = epDescComposite.getCorrespondingClass(); + assertEquals(ClientDBCSupportEndpointSEI.class, seiClass); + // Make sure we didn't overwrite the class in the ServiceDesc composite + assertEquals(ClientDBCSupportEndpointServiceSubclass.class, + svcDescComposite.getCorrespondingClass()); + + } + + /** + * Verify that the code that uses a simple empty sparse composite to create an endpoint. + */ + public void testSimpleComposite() { + QName serviceQName = new QName(namespaceURI, svcLocalPart); + + ServiceDescription svcDesc = DescriptionFactory.createServiceDescription(null, serviceQName, ClientDBCSupportEndpointServiceSubclass.class); + assertNotNull(svcDesc); + ServiceDescriptionImpl svcDescImpl = (ServiceDescriptionImpl) svcDesc; + DescriptionBuilderComposite svcDescComposite = svcDescImpl.getDescriptionBuilderComposite(); + assertNotNull(svcDescComposite); + + Class testServiceClass = svcDescComposite.getCorrespondingClass(); + assertNotNull(testServiceClass); + assertEquals(ClientDBCSupportEndpointServiceSubclass.class, testServiceClass); + + // Now update with an SEI + QName portQName = new QName(namespaceURI, portLocalPart); + DescriptionBuilderComposite setEpDescComposite = new DescriptionBuilderComposite(); + Object compositeKey = "Key1"; + EndpointDescription epDesc = + DescriptionFactory.updateEndpoint(svcDesc, ClientDBCSupportEndpointSEI.class, portQName, DescriptionFactory.UpdateType.GET_PORT, + setEpDescComposite, compositeKey); + assertNotNull(epDesc); + EndpointDescriptionImpl epDescImpl = (EndpointDescriptionImpl) epDesc; + DescriptionBuilderComposite epDescComposite = epDescImpl.getDescriptionBuilderComposite(); + // The sparse composite should NOT be equal to the composite in the EndpointDescription + // The sparse composite SHOULD be equal to the sparse composite contained in the EndpointDescription + assertNotSame(setEpDescComposite, epDescComposite); + assertEquals(setEpDescComposite, epDescComposite.getSparseComposite(compositeKey)); + Class seiClass = epDescComposite.getCorrespondingClass(); + assertEquals(ClientDBCSupportEndpointSEI.class, seiClass); + // Make sure we didn't overwrite the class in the ServiceDesc composite + assertEquals(ClientDBCSupportEndpointServiceSubclass.class, + svcDescComposite.getCorrespondingClass()); + + } + + /** + * A composite can not be specified when doing an AddPort + */ + public void testAddPort() { + QName serviceQName = new QName(namespaceURI, svcLocalPart); + + ServiceDescription svcDesc = DescriptionFactory.createServiceDescription(null, serviceQName, ClientDBCSupportEndpointServiceSubclass.class); + assertNotNull(svcDesc); + ServiceDescriptionImpl svcDescImpl = (ServiceDescriptionImpl) svcDesc; + DescriptionBuilderComposite svcDescComposite = svcDescImpl.getDescriptionBuilderComposite(); + assertNotNull(svcDescComposite); + + Class testServiceClass = svcDescComposite.getCorrespondingClass(); + assertNotNull(testServiceClass); + assertEquals(ClientDBCSupportEndpointServiceSubclass.class, testServiceClass); + + // Now update with an SEI + QName portQName = new QName(namespaceURI, portLocalPart); + DescriptionBuilderComposite setEpDescComposite = new DescriptionBuilderComposite(); + Object compositeKey = "Key1"; + try { + EndpointDescription epDesc = + DescriptionFactory.updateEndpoint(svcDesc, ClientDBCSupportEndpointSEI.class, portQName, DescriptionFactory.UpdateType.ADD_PORT, + setEpDescComposite, compositeKey); + fail("Should have caught an exception"); + } + catch (WebServiceException e) { + // Expected path + } + + } + + /** + * Composite can not be specified with a CREATE_DISPATCH + */ + public void testCreateDispatch() { + QName serviceQName = new QName(namespaceURI, svcLocalPart); + + ServiceDescription svcDesc = DescriptionFactory.createServiceDescription(null, serviceQName, ClientDBCSupportEndpointServiceSubclass.class); + assertNotNull(svcDesc); + ServiceDescriptionImpl svcDescImpl = (ServiceDescriptionImpl) svcDesc; + DescriptionBuilderComposite svcDescComposite = svcDescImpl.getDescriptionBuilderComposite(); + assertNotNull(svcDescComposite); + + Class testServiceClass = svcDescComposite.getCorrespondingClass(); + assertNotNull(testServiceClass); + assertEquals(ClientDBCSupportEndpointServiceSubclass.class, testServiceClass); + + // Now update with an SEI + QName portQName = new QName(namespaceURI, portLocalPart); + DescriptionBuilderComposite setEpDescComposite = new DescriptionBuilderComposite(); + Object compositeKey = "Key1"; + try { + EndpointDescription epDesc = + DescriptionFactory.updateEndpoint(svcDesc, null /* SEI can't be specified */, + portQName, + DescriptionFactory.UpdateType.CREATE_DISPATCH, + setEpDescComposite, compositeKey); + fail("Should have caught an exception"); + } + catch (WebServiceException e) { + // Expected path + assertTrue(e.toString().contains("CreateDispatch can not have a composite")); + } + } + + /** + * Update a port that was created from WSDL (i.e. a declared port) with a composite. To get + * into a state where a declared port would need to be updated: + * 1) Do a CREATE_DISPATCH on a declared wsdl port + * 2) Do a GET_PORT on that port, providing an SEI. + * In this case, the EndpointDescription is shared between the two, but the sparse composite + * specified on the GET_PORT should be unique to it. + */ + public void testUpdateDeclaredPort() { + QName serviceQName = new QName(namespaceURI, svcLocalPart); + + ServiceDescription svcDesc = DescriptionFactory.createServiceDescription(getWsdlURL(), serviceQName, Service.class); + + QName portQName = new QName(namespaceURI, portLocalPart); + + // First we do a CREATE_DISPATCH to create the EndpointDescription for the WSDL port. + // Note that we don't specify a composite (because that isn't allowed for CREATE_DISPATCH) + // and one will be created by the runtime + EndpointDescription epDescForCreate = + DescriptionFactory.updateEndpoint(svcDesc, null /* SEI can't be specified */, + portQName, + DescriptionFactory.UpdateType.CREATE_DISPATCH); + EndpointDescriptionImpl epDescImpl = (EndpointDescriptionImpl) epDescForCreate; + DescriptionBuilderComposite createDispatchComposite = epDescImpl.getDescriptionBuilderComposite(); + assertNotNull(createDispatchComposite); + // There really shouldn't be any sparse composites at this point; make sure by checking a + // couple obvious things that might be used as a key. + assertNull(epDescImpl.getDescriptionBuilderComposite().getSparseComposite(createDispatchComposite)); + assertNull(epDescImpl.getDescriptionBuilderComposite().getSparseComposite(null)); + + DescriptionBuilderComposite updateEndpointComposite = new DescriptionBuilderComposite(); + Object compositeKey = "KEY1"; + EndpointDescription epDescForGetPort = + DescriptionFactory.updateEndpoint(svcDesc, ClientDBCSupportEndpointSEI.class, portQName, DescriptionFactory.UpdateType.GET_PORT, + updateEndpointComposite, compositeKey); + assertEquals(epDescForCreate, epDescForGetPort); + + // The update needs to have set the sparse composite (like for a given ServiceDelegate + // instance) without having lost the different composite for the create. The EndpointDescripton + // can be shared, but the sparse composite overrides they contain need to be unique (like to the ServiceDelegates) + assertTrue(createDispatchComposite != updateEndpointComposite); + assertEquals(updateEndpointComposite, epDescImpl.getDescriptionBuilderComposite().getSparseComposite(compositeKey)); + // Make sure this didn't change any of the sparse information (which is none) for the previous create + assertNull(epDescImpl.getDescriptionBuilderComposite().getSparseComposite(createDispatchComposite)); + assertNull(epDescImpl.getDescriptionBuilderComposite().getSparseComposite(null)); + + } + + /** + * Do multiple GET_PORT on the same service. This should share the same EndpointDescription + * but the sparse composite specified on GET_PORT should be unique to each key. + */ + public void testMultipleGetPort() { + QName serviceQName = new QName(namespaceURI, svcLocalPart); + ServiceDescription svcDesc = DescriptionFactory.createServiceDescription(getWsdlURL(), serviceQName, Service.class); + QName portQName = new QName(namespaceURI, portLocalPart); + + // Do the first GetPort using sd1 as a key for the sparse composite + DescriptionBuilderComposite sd1Composite = new DescriptionBuilderComposite(); + Object sd1 = "SD1"; + EndpointDescription epDescForGetPort1 = + DescriptionFactory.updateEndpoint(svcDesc, ClientDBCSupportEndpointSEI.class, portQName, DescriptionFactory.UpdateType.GET_PORT, + sd1Composite, sd1); + assertNotNull(epDescForGetPort1); + EndpointDescriptionImpl epDescImpl1 = (EndpointDescriptionImpl) epDescForGetPort1; + assertEquals(sd1Composite, epDescImpl1.getDescriptionBuilderComposite().getSparseComposite(sd1)); + + // Do the second GetPort using sd2 as a key for the sparse composite + DescriptionBuilderComposite sd2Composite = new DescriptionBuilderComposite(); + Object sd2 = "SD2"; + EndpointDescription epDescForGetPort2 = + DescriptionFactory.updateEndpoint(svcDesc, ClientDBCSupportEndpointSEI.class, portQName, DescriptionFactory.UpdateType.GET_PORT, + sd2Composite, sd2); + assertNotNull(epDescForGetPort2); + assertEquals(epDescForGetPort1, epDescForGetPort2); + EndpointDescriptionImpl epDescImpl2 = (EndpointDescriptionImpl) epDescForGetPort2; + assertNotSame(sd1Composite, sd2Composite); + assertEquals(sd2Composite, epDescImpl2.getDescriptionBuilderComposite().getSparseComposite(sd2)); + assertEquals(sd1Composite, epDescImpl1.getDescriptionBuilderComposite().getSparseComposite(sd1)); + } + + static URL getWsdlURL() { + URL url = null; + String wsdlLocation = null; + try { + try{ + String baseDir = new File(System.getProperty("basedir",".")).getCanonicalPath(); + + wsdlLocation = new File(baseDir + "/test-resources/wsdl/ClientEndpointMetadata.wsdl").getAbsolutePath(); + }catch(Exception e){ + e.printStackTrace(); + fail("Exception creating File(WSDL): " + e.toString()); + } + File file = new File(wsdlLocation); + url = file.toURL(); + } catch (MalformedURLException e) { + e.printStackTrace(); + fail("Exception converting WSDL file to URL: " + e.toString()); + } + return url; + } + +} + [EMAIL PROTECTED](targetNamespace="originalTNS", wsdlLocation="originalWsdlLocation") +class ClientDBCSupportEndpointServiceSubclass extends javax.xml.ws.Service { + + protected ClientDBCSupportEndpointServiceSubclass(URL wsdlDocumentLocation, QName serviceName) { + super(wsdlDocumentLocation, serviceName); + } +} + [EMAIL PROTECTED] +interface ClientDBCSupportEndpointSEI { + public String echo (String string); +} + [EMAIL PROTECTED](serviceName = "EchoService", endpointInterface="org.apache.ws.axis2.tests.EchoPort") +class ClientDBCSupportEndpointEchoServiceImplWithSEI { + public void echo(Holder<String> text) { + text.value = "Echo " + text.value; + } +}
Added: webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/impl/ClientDBCSupportTests.java URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/impl/ClientDBCSupportTests.java?rev=611042&view=auto ============================================================================== --- webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/impl/ClientDBCSupportTests.java (added) +++ webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/impl/ClientDBCSupportTests.java Thu Jan 10 19:56:14 2008 @@ -0,0 +1,226 @@ +/* + * 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.axis2.jaxws.description.impl; + +import org.apache.axis2.description.AxisService; +import org.apache.axis2.jaxws.description.DescriptionFactory; +import org.apache.axis2.jaxws.description.DescriptionTestUtils; +import org.apache.axis2.jaxws.description.EndpointDescription; +import org.apache.axis2.jaxws.description.ServiceDescription; +import org.apache.axis2.jaxws.description.builder.DescriptionBuilderComposite; +import org.apache.axis2.jaxws.description.builder.WebServiceClientAnnot; + +import javax.jws.WebService; +import javax.xml.namespace.QName; +import javax.xml.ws.Holder; +import javax.xml.ws.WebServiceClient; + +import java.net.URL; + +import junit.framework.TestCase; + +/** + * Test client sparse composite support in the MDQ layer at the Service creation level. + */ +public class ClientDBCSupportTests extends TestCase { + private String namespaceURI = "http://org.apache.axis2.jaxws.description.impl.ClientDBCSupportTests"; + private String svcLocalPart = "svcLocalPart"; + private String portLocalPart = "portLocalPart"; + + /** + * Test the previous way of constructing a ServiceDescription and then updating it with an + * Endpoint. This is verifying that the previous APIs work as expected. + */ + public void testServiceAndSeiClass() { + + QName serviceQName = new QName(namespaceURI, svcLocalPart); + + ServiceDescription svcDesc = DescriptionFactory.createServiceDescription(null, serviceQName, ClientDBCSupportServiceSubclass.class); + assertNotNull(svcDesc); + ServiceDescriptionImpl svcDescImpl = (ServiceDescriptionImpl) svcDesc; + DescriptionBuilderComposite svcDescComposite = svcDescImpl.getDescriptionBuilderComposite(); + assertNotNull(svcDescComposite); + + Class testServiceClass = svcDescComposite.getCorrespondingClass(); + assertNotNull(testServiceClass); + assertEquals(ClientDBCSupportServiceSubclass.class, testServiceClass); + + // Now update with an SEI + QName portQName = new QName(namespaceURI, portLocalPart); + EndpointDescription epDesc = + DescriptionFactory.updateEndpoint(svcDesc, ClientDBCSupportSEI.class, portQName, DescriptionFactory.UpdateType.GET_PORT); + assertNotNull(epDesc); + EndpointDescriptionImpl epDescImpl = (EndpointDescriptionImpl) epDesc; + DescriptionBuilderComposite epDescComposite = epDescImpl.getDescriptionBuilderComposite(); + Class seiClass = epDescComposite.getCorrespondingClass(); + assertEquals(ClientDBCSupportSEI.class, seiClass); + // Make sure we didn't overwrite the class in the ServiceDesc composite + assertEquals(ClientDBCSupportServiceSubclass.class, + svcDescComposite.getCorrespondingClass()); + } + + /** + * Create a ServiceDescription with a composite. Nothing in the composite is overriden; validate + * the values from the annotions in the Service class. + */ + public void testClientServiceClassComposite() { + QName serviceQName = new QName(namespaceURI, svcLocalPart); + DescriptionBuilderComposite composite = new DescriptionBuilderComposite(); + Object compositeKey = "CompositeKey"; + ServiceDescription svcDesc = + new ServiceDescriptionImpl(null, serviceQName, + ClientDBCSupportServiceSubclass.class, + composite, compositeKey); + assertNotNull(svcDesc); + ServiceDescriptionImpl svcDescImpl = (ServiceDescriptionImpl) svcDesc; + DescriptionBuilderComposite svcDescComposite = svcDescImpl.getDescriptionBuilderComposite(); + assertNotNull(svcDescComposite); + assertNotSame(composite, svcDescComposite); + assertSame(composite, svcDescComposite.getSparseComposite(compositeKey)); + + WebServiceClient wsClient = svcDescComposite.getWebServiceClientAnnot(); + assertNotNull(wsClient); + assertEquals("originalWsdlLocation", wsClient.wsdlLocation()); + assertEquals("originalTNS", wsClient.targetNamespace()); + // We're testing the composite, not the metadata layer, so none of the defaulting logic + // is exercised. + assertEquals("", wsClient.name()); + + } + + /** + * Create a ServiceDescription using a sparse composite that overrides the wsdlLocation on the + * WebServiceClient annotation. Validate the override only affects the wsdlLocation and not + * the other annotations members. + */ + public void testServiceClientWSDLLocationOverride() { + QName serviceQName = new QName(namespaceURI, svcLocalPart); + // Create a composite with a WebServiceClient override of the WSDL location. + DescriptionBuilderComposite composite = new DescriptionBuilderComposite(); + String overridenWsdlLocation = DescriptionTestUtils.getWSDLLocation("ClientEndpointMetadata.wsdl"); + WebServiceClientAnnot wsClientAnno = WebServiceClientAnnot.createWebServiceClientAnnotImpl(null, null, overridenWsdlLocation); + composite.setWebServiceClientAnnot(wsClientAnno); + Object compositeKey = "CompositeKey"; + ServiceDescription svcDesc = + new ServiceDescriptionImpl(null, serviceQName, + ClientDBCSupportServiceSubclass.class, + composite, compositeKey); + assertNotNull(svcDesc); + ServiceDescriptionImpl svcDescImpl = (ServiceDescriptionImpl) svcDesc; + DescriptionBuilderComposite svcDescComposite = svcDescImpl.getDescriptionBuilderComposite(); + assertNotNull(svcDescComposite); + assertNotSame(composite, svcDescComposite); + assertSame(composite, svcDescComposite.getSparseComposite(compositeKey)); + // The client annot we set as a sparse composite should be the same. + assertSame(wsClientAnno, svcDescComposite.getSparseComposite(compositeKey).getWebServiceClientAnnot()); + // The WebServiceClient annot on the service desc should represent the wsdl override from the + // sparse composite + WebServiceClient wsClient = svcDescComposite.getWebServiceClientAnnot(compositeKey); + assertEquals(overridenWsdlLocation, wsClient.wsdlLocation()); + // Make sure the non-overridden values still come from the service class annotation + assertEquals("originalTNS", wsClient.targetNamespace()); + assertEquals("", wsClient.name()); + + } + + /** + * The other path through MDQ that didn't use DBCs was creating the service impl hierachy + * using reflection on the service impl class. This is deprecated but it is used in the JAXWS + * open source tests (for now). So, this validates we don't break those tests. + * + * When the deprecated logic is removed, this test can also be removed. + */ + public void testDeprecatedServiceImplConstruction() { + AxisService axisService = new AxisService(); + ServiceDescription svcDesc = DescriptionFactory. + createServiceDescriptionFromServiceImpl(ClientDBCSupportEchoServiceImplWithSEI.class, axisService); + assertNotNull(svcDesc); + ServiceDescriptionImpl svcDescImpl = (ServiceDescriptionImpl) svcDesc; + DescriptionBuilderComposite svcDescComposite = svcDescImpl.getDescriptionBuilderComposite(); + assertNotNull(svcDescComposite); + + // Since this is a server-side impl, there should be no class corresponding to the client-side + // Service class. + assertNull(svcDescComposite.getCorrespondingClass()); + } + /** + * Test the ability to set a prefered port on a service description via a sparse composite. + */ + public void testPreferredPort() { + QName serviceQName = new QName(namespaceURI, svcLocalPart); + DescriptionBuilderComposite composite = new DescriptionBuilderComposite(); + QName preferredPort = new QName("preferredTNS", "preferredLP"); + composite.setPreferredPort(preferredPort); + Object compositeKey = "CompositeKey"; + ServiceDescription svcDesc = + DescriptionFactory.createServiceDescription(null, serviceQName, + ClientDBCSupportServiceSubclass.class, + composite, compositeKey); + DescriptionBuilderComposite svcDescComposite = DescriptionTestUtils.getServiceDescriptionComposite(svcDesc); + assertNotNull(svcDescComposite); + assertNull(svcDescComposite.getPreferredPort()); + DescriptionBuilderComposite svcDescSparseComposite = svcDescComposite.getSparseComposite(compositeKey); + assertNotNull(svcDescSparseComposite); + assertSame(preferredPort, svcDescSparseComposite.getPreferredPort()); + assertSame(preferredPort, svcDescComposite.getPreferredPort(compositeKey)); + } + + /** + * Test the ability to set MTOM enablement on a service description via a sparse composite. + */ + public void testMTOMEnablement() { + QName serviceQName = new QName(namespaceURI, svcLocalPart); + DescriptionBuilderComposite composite = new DescriptionBuilderComposite(); + composite.setIsMTOMEnabled(true); + Object compositeKey = "CompositeKey"; + ServiceDescription svcDesc = + DescriptionFactory.createServiceDescription(null, serviceQName, + ClientDBCSupportServiceSubclass.class, + composite, compositeKey); + DescriptionBuilderComposite svcDescComposite = DescriptionTestUtils.getServiceDescriptionComposite(svcDesc); + assertNotNull(svcDescComposite); + assertFalse(svcDescComposite.isMTOMEnabled()); + DescriptionBuilderComposite svcDescSparseComposite = svcDescComposite.getSparseComposite(compositeKey); + assertNotNull(svcDescSparseComposite); + assertTrue(svcDescSparseComposite.isMTOMEnabled()); + assertTrue(svcDescComposite.isMTOMEnabled(compositeKey)); + } + +} + [EMAIL PROTECTED](targetNamespace="originalTNS", wsdlLocation="originalWsdlLocation") +class ClientDBCSupportServiceSubclass extends javax.xml.ws.Service { + + protected ClientDBCSupportServiceSubclass(URL wsdlDocumentLocation, QName serviceName) { + super(wsdlDocumentLocation, serviceName); + } +} + [EMAIL PROTECTED] +interface ClientDBCSupportSEI { + public String echo (String string); +} + [EMAIL PROTECTED](serviceName = "EchoService", endpointInterface="org.apache.ws.axis2.tests.EchoPort") +class ClientDBCSupportEchoServiceImplWithSEI { + public void echo(Holder<String> text) { + text.value = "Echo " + text.value; + } + +} Modified: webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/impl/DescriptionFactoryImplTests.java URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/impl/DescriptionFactoryImplTests.java?rev=611042&r1=611041&r2=611042&view=diff ============================================================================== --- webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/impl/DescriptionFactoryImplTests.java (original) +++ webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/impl/DescriptionFactoryImplTests.java Thu Jan 10 19:56:14 2008 @@ -131,8 +131,10 @@ DescriptionFactoryImpl.clearServiceDescriptionCache(null); } finally { - // restore old factory + // restore old factory by updating the registry THEN clearing the cached factory + // so it is retrieved from the table again. MetadataFactoryRegistry.setFactory(ClientConfigurationFactory.class, oldFactory); + resetClientConfigFactory(); } } @@ -147,7 +149,7 @@ SampleAnnotationProcessor saProcessor = new SampleAnnotationProcessor(); saProcessor.setAnnotationInstanceClassName(sampleAnnotation.getClass().getName()); dbc.addCustomAnnotationProcessor(saProcessor); - WebServiceAnnot webService = dbc.getWebServiceAnnot(); + WebService webService = dbc.getWebServiceAnnot(); assertNotNull(webService); String pn = webService.portName(); String tns = webService.targetNamespace(); @@ -238,7 +240,7 @@ if (context == null) { context = super.getClientConfigurationContext(); } - System.out.println(context); + System.out.println("Test version of CachingClientContextFactory: " + context); return context; } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]