use of org.apache.axis2.jaxws.description.builder.DescriptionBuilderComposite in project axis-axis2-java-core by apache.
the class ClientDBCSupportEndpointEchoServiceImplWithSEI method testCreateDispatch.
/**
* 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
String msg = Messages.getMessage("serviceDescErr6");
assertTrue(e.toString().contains(msg));
}
}
use of org.apache.axis2.jaxws.description.builder.DescriptionBuilderComposite in project axis-axis2-java-core by apache.
the class ClientDBCSupportEndpointEchoServiceImplWithSEI method testPreDBCFunctionality.
/**
* 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());
}
use of org.apache.axis2.jaxws.description.builder.DescriptionBuilderComposite in project axis-axis2-java-core by apache.
the class ClientDBCSupportEndpointEchoServiceImplWithSEI method testSimpleComposite.
/**
* 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());
}
use of org.apache.axis2.jaxws.description.builder.DescriptionBuilderComposite in project axis-axis2-java-core by apache.
the class ClientDBCSupportEndpointEchoServiceImplWithSEI method testMultipleGetPort.
/**
* 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));
}
use of org.apache.axis2.jaxws.description.builder.DescriptionBuilderComposite in project axis-axis2-java-core by apache.
the class ClientDBCSupportEndpointEchoServiceImplWithSEI method testAddPort.
/**
* 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
}
}
Aggregations