use of org.apache.cxf.service.model.ServiceInfo in project cxf by apache.
the class JaxwsServiceBuilderTest method testAsync.
@Test
public void testAsync() throws Exception {
builder.setServiceClass(org.apache.hello_world_async_soap_http.GreeterAsync.class);
ServiceInfo service = builder.createService();
generator.setServiceModel(service);
File output = getOutputFile("hello_async.wsdl");
assertNotNull(output);
generator.generate(output);
assertTrue(output.exists());
InputStream expectedFile = getClass().getResourceAsStream("expected/expected_hello_world_async.wsdl");
assertWsdlEquals(expectedFile, output);
}
use of org.apache.cxf.service.model.ServiceInfo in project cxf by apache.
the class RequestWrapperTest method getOperation.
private OperationInfo getOperation(Class<?> clz, String opName) {
builder.setServiceClass(clz);
ServiceInfo serviceInfo = builder.createService();
for (OperationInfo op : serviceInfo.getInterface().getOperations()) {
if (op.getUnwrappedOperation() != null && op.hasInput() && opName.equals(op.getName().getLocalPart())) {
return op;
}
}
return null;
}
use of org.apache.cxf.service.model.ServiceInfo in project cxf by apache.
the class JaxwsServiceBuilderNoAnnoTest method testGeneratedWithRPCClass.
// * Missing wsdl:types
// * input message of binding operation "getPrice" MUST specify a value for the "namespace" attribute
// * output message of binding operation "getPrice" MUST specify a value for the "namespace" attribute
// CXF-527
@Test
public void testGeneratedWithRPCClass() throws Exception {
builder.setServiceClass(org.apache.cxf.tools.fortest.classnoanno.rpc.Stock.class);
builder.setAddress("http://localhost");
ServiceInfo service = builder.createService();
generator.setServiceModel(service);
File output = getOutputFile("stock_noanno_rpc.wsdl");
generator.generate(output);
assertTrue(output.exists());
InputStream expectedFile = getClass().getResourceAsStream("expected/stock_noanno_rpc.wsdl");
assertWsdlEquals(expectedFile, output);
}
use of org.apache.cxf.service.model.ServiceInfo in project cxf by apache.
the class NettyHttpDestinationTest method setUpDestination.
private NettyHttpDestination setUpDestination(boolean contextMatchOnStem, boolean mockedBus) throws Exception {
policy = new HTTPServerPolicy();
address = getEPR("bar/foo");
transportFactory = new HTTPTransportFactory();
final ConduitInitiator ci = new ConduitInitiator() {
public Conduit getConduit(EndpointInfo targetInfo, Bus b) throws IOException {
return decoupledBackChannel;
}
public Conduit getConduit(EndpointInfo localInfo, EndpointReferenceType target, Bus b) throws IOException {
return decoupledBackChannel;
}
public List<String> getTransportIds() {
return null;
}
public Set<String> getUriPrefixes() {
return new HashSet<>(Collections.singletonList("http"));
}
};
ConduitInitiatorManager mgr = new ConduitInitiatorManager() {
public void deregisterConduitInitiator(String name) {
}
public ConduitInitiator getConduitInitiator(String name) throws BusException {
return null;
}
public ConduitInitiator getConduitInitiatorForUri(String uri) {
return ci;
}
public void registerConduitInitiator(String name, ConduitInitiator factory) {
}
};
if (!mockedBus) {
bus = new ExtensionManagerBus();
bus.setExtension(mgr, ConduitInitiatorManager.class);
} else {
bus = EasyMock.createMock(Bus.class);
bus.getExtension(EndpointResolverRegistry.class);
EasyMock.expectLastCall().andReturn(null);
bus.getExtension(ContinuationProviderFactory.class);
EasyMock.expectLastCall().andReturn(null).anyTimes();
bus.getExtension(PolicyDataEngine.class);
EasyMock.expectLastCall().andReturn(null).anyTimes();
bus.hasExtensionByName("org.apache.cxf.ws.policy.PolicyEngine");
EasyMock.expectLastCall().andReturn(false);
bus.getExtension(ClassLoader.class);
EasyMock.expectLastCall().andReturn(this.getClass().getClassLoader());
EasyMock.replay(bus);
}
engine = EasyMock.createNiceMock(NettyHttpServerEngine.class);
ServiceInfo serviceInfo = new ServiceInfo();
serviceInfo.setName(new QName("bla", "Service"));
endpointInfo = new EndpointInfo(serviceInfo, "");
endpointInfo.setName(new QName("bla", "Port"));
endpointInfo.setAddress(NOWHERE + "bar/foo");
endpointInfo.addExtensor(policy);
engine.addServant(EasyMock.eq(new URL(NOWHERE + "bar/foo")), EasyMock.isA(NettyHttpHandler.class));
EasyMock.expectLastCall();
EasyMock.replay(engine);
NettyHttpDestination dest = new EasyMockJettyHTTPDestination(bus, transportFactory.getRegistry(), endpointInfo, null, engine);
dest.retrieveEngine();
policy = dest.getServer();
observer = new MessageObserver() {
public void onMessage(Message m) {
inMessage = m;
threadDefaultBus = BusFactory.getThreadDefaultBus();
}
};
dest.setMessageObserver(observer);
return dest;
}
use of org.apache.cxf.service.model.ServiceInfo in project cxf by apache.
the class NettyHttpDestinationTest method testServerPolicyInServiceModel.
@Test
public void testServerPolicyInServiceModel() throws Exception {
policy = new HTTPServerPolicy();
address = getEPR("bar/foo");
bus = new ExtensionManagerBus();
transportFactory = new HTTPTransportFactory();
ServiceInfo serviceInfo = new ServiceInfo();
serviceInfo.setName(new QName("bla", "Service"));
endpointInfo = new EndpointInfo(serviceInfo, "");
endpointInfo.setName(new QName("bla", "Port"));
endpointInfo.addExtensor(policy);
engine = EasyMock.createMock(NettyHttpServerEngine.class);
EasyMock.replay();
endpointInfo.setAddress(NOWHERE + "bar/foo");
NettyHttpDestination dest = new EasyMockJettyHTTPDestination(bus, transportFactory.getRegistry(), endpointInfo, null, engine);
assertEquals(policy, dest.getServer());
}
Aggregations