Java Code Examples for org.apache.cxf.service.model.ServiceInfo#setName()
The following examples show how to use
org.apache.cxf.service.model.ServiceInfo#setName() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NettyHttpDestinationTest.java From cxf with Apache License 2.0 | 6 votes |
@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()); }
Example 2
Source File: NettyHttpDestinationTest.java From cxf with Apache License 2.0 | 6 votes |
@Test public void testGetMultiple() throws Exception { transportFactory = new HTTPTransportFactory(); bus = BusFactory.getDefaultBus(); ServiceInfo serviceInfo = new ServiceInfo(); serviceInfo.setName(new QName("bla", "Service")); EndpointInfo ei = new EndpointInfo(serviceInfo, ""); ei.setName(new QName("bla", "Port")); ei.setAddress("http://foo"); Destination d1 = transportFactory.getDestination(ei, bus); Destination d2 = transportFactory.getDestination(ei, bus); // Second get should not generate a new destination. It should just retrieve the existing one assertEquals(d1, d2); d2.shutdown(); Destination d3 = transportFactory.getDestination(ei, bus); // Now a new destination should have been created assertNotSame(d1, d3); }
Example 3
Source File: JettyHTTPDestinationTest.java From cxf with Apache License 2.0 | 6 votes |
@Test public void testGetMultiple() throws Exception { bus = BusFactory.getDefaultBus(true); transportFactory = new HTTPTransportFactory(); ServiceInfo serviceInfo = new ServiceInfo(); serviceInfo.setName(new QName("bla", "Service")); EndpointInfo ei = new EndpointInfo(serviceInfo, ""); ei.setName(new QName("bla", "Port")); ei.setAddress("http://foo"); Destination d1 = transportFactory.getDestination(ei, bus); Destination d2 = transportFactory.getDestination(ei, bus); // Second get should not generate a new destination. It should just retrieve the existing one assertEquals(d1, d2); d2.shutdown(); Destination d3 = transportFactory.getDestination(ei, bus); // Now a new destination should have been created assertNotSame(d1, d3); }
Example 4
Source File: JettyHTTPDestinationTest.java From cxf with Apache License 2.0 | 6 votes |
@Test public void testServerPolicyInServiceModel() throws Exception { policy = new HTTPServerPolicy(); address = getEPR("bar/foo"); bus = BusFactory.getDefaultBus(true); 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(JettyHTTPServerEngine.class); EasyMock.replay(); endpointInfo.setAddress(NOWHERE + "bar/foo"); JettyHTTPDestination dest = new EasyMockJettyHTTPDestination( bus, transportFactory.getRegistry(), endpointInfo, null, engine); assertEquals(policy, dest.getServer()); }
Example 5
Source File: UndertowHTTPDestinationTest.java From cxf with Apache License 2.0 | 6 votes |
@Test public void testServerPolicyInServiceModel() throws Exception { policy = new HTTPServerPolicy(); address = getEPR("bar/foo"); bus = BusFactory.getDefaultBus(true); 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(UndertowHTTPServerEngine.class); EasyMock.replay(); endpointInfo.setAddress(NOWHERE + "bar/foo"); UndertowHTTPDestination dest = new EasyMockUndertowHTTPDestination( bus, transportFactory.getRegistry(), endpointInfo, null, engine); assertEquals(policy, dest.getServer()); }
Example 6
Source File: AbstractSTSTokenTest.java From cxf with Apache License 2.0 | 6 votes |
static MessageImpl prepareMessage(Bus bus, STSClient stsClient, String serviceAddress) throws EndpointException { MessageImpl message = new MessageImpl(); message.put(SecurityConstants.STS_CLIENT, stsClient); message.put(Message.ENDPOINT_ADDRESS, serviceAddress); Exchange exchange = new ExchangeImpl(); ServiceInfo si = new ServiceInfo(); si.setName(new QName("http://www.apache.org", "ServiceName")); Service s = new ServiceImpl(si); EndpointInfo ei = new EndpointInfo(); ei.setName(new QName("http://www.apache.org", "EndpointName")); Endpoint ep = new EndpointImpl(bus, s, ei); ei.setBinding(new BindingInfo(si, null)); message.setExchange(exchange); exchange.put(Endpoint.class, ep); return message; }
Example 7
Source File: UndertowHTTPDestinationTest.java From cxf with Apache License 2.0 | 6 votes |
@Test public void testGetMultiple() throws Exception { bus = BusFactory.getDefaultBus(true); transportFactory = new HTTPTransportFactory(); ServiceInfo serviceInfo = new ServiceInfo(); serviceInfo.setName(new QName("bla", "Service")); EndpointInfo ei = new EndpointInfo(serviceInfo, ""); ei.setName(new QName("bla", "Port")); ei.setAddress("http://foo"); Destination d1 = transportFactory.getDestination(ei, bus); Destination d2 = transportFactory.getDestination(ei, bus); // Second get should not generate a new destination. It should just retrieve the existing one assertEquals(d1, d2); d2.shutdown(); Destination d3 = transportFactory.getDestination(ei, bus); // Now a new destination should have been created assertNotSame(d1, d3); }
Example 8
Source File: UndertowHTTPDestinationTest.java From cxf with Apache License 2.0 | 5 votes |
@Test public void testRandomPortAllocation() throws Exception { bus = BusFactory.getDefaultBus(true); transportFactory = new HTTPTransportFactory(); ServiceInfo serviceInfo = new ServiceInfo(); serviceInfo.setName(new QName("bla", "Service")); EndpointInfo ei = new EndpointInfo(serviceInfo, ""); ei.setName(new QName("bla", "Port")); Destination d1 = transportFactory.getDestination(ei, bus); URL url = new URL(d1.getAddress().getAddress().getValue()); assertTrue("No random port has been allocated", url.getPort() > 0); }
Example 9
Source File: NettyHttpConduitFactoryTest.java From cxf with Apache License 2.0 | 5 votes |
@Test public void testShutdownEventLoopGroup() throws Exception { bus = BusFactory.getDefaultBus(true); assertNotNull("Cannot get bus", bus); // Make sure we got the Transport Factory. NettyHttpTransportFactory factory = bus.getExtension(NettyHttpTransportFactory.class); assertNotNull("Cannot get NettyHttpTransportFactory", factory); ServiceInfo serviceInfo = new ServiceInfo(); serviceInfo.setName(new QName("bla", "Service")); EndpointInfo ei = new EndpointInfo(serviceInfo, ""); ei.setName(new QName("bla", "Port")); ei.setAddress("netty://foo"); // The EventLoopGroup is put into bus when create a new netty http conduit factory.getConduit(ei, null, bus); bus.shutdown(true); EventLoopGroup eventLoopGroup = bus.getExtension(EventLoopGroup.class); assertNotNull("We should find the EventLoopGroup here.", eventLoopGroup); assertTrue("The eventLoopGroup should be shutdown.", eventLoopGroup.isShutdown()); }
Example 10
Source File: NettyHttpDestinationTest.java From cxf with Apache License 2.0 | 5 votes |
@Test public void testContinuationsIgnored() throws Exception { HttpServletRequest httpRequest = EasyMock.createMock(HttpServletRequest.class); ServiceInfo serviceInfo = new ServiceInfo(); serviceInfo.setName(new QName("bla", "Service")); EndpointInfo ei = new EndpointInfo(serviceInfo, ""); ei.setName(new QName("bla", "Port")); // Just create a fake engine final NettyHttpServerEngine httpEngine = new NettyHttpServerEngine("localhost", 8080); //httpEngine.setContinuationsEnabled(false); NettyHttpServerEngineFactory factory = new NettyHttpServerEngineFactory() { @Override public NettyHttpServerEngine retrieveNettyHttpServerEngine(int port) { return httpEngine; } }; transportFactory = new HTTPTransportFactory(); bus = BusFactory.getDefaultBus(); bus.setExtension(factory, NettyHttpServerEngineFactory.class); TestJettyDestination testDestination = new TestJettyDestination(bus, transportFactory.getRegistry(), ei, factory); testDestination.finalizeConfig(); Message mi = testDestination.retrieveFromContinuation(httpRequest); assertNull("Continuations must be ignored", mi); }
Example 11
Source File: NettyHttpDestinationTest.java From cxf with Apache License 2.0 | 5 votes |
@Test public void testRandomPortAllocation() throws Exception { bus = BusFactory.getDefaultBus(); transportFactory = new HTTPTransportFactory(); ServiceInfo serviceInfo = new ServiceInfo(); serviceInfo.setName(new QName("bla", "Service")); EndpointInfo ei = new EndpointInfo(serviceInfo, ""); ei.setName(new QName("bla", "Port")); Destination d1 = transportFactory.getDestination(ei, bus); URL url = new URL(d1.getAddress().getAddress().getValue()); assertTrue("No random port has been allocated", url.getPort() > 0); }
Example 12
Source File: ApplicationContextTest.java From cxf with Apache License 2.0 | 5 votes |
private EndpointInfo getEndpointInfo(String serviceNS, String endpointLocal, String address) { ServiceInfo serviceInfo2 = new ServiceInfo(); serviceInfo2.setName(new QName(serviceNS, "Service")); EndpointInfo info2 = new EndpointInfo(serviceInfo2, ""); info2.setName(new QName("urn:test:ns", endpointLocal)); info2.setAddress(address); return info2; }
Example 13
Source File: UndertowHTTPDestinationTest.java From cxf with Apache License 2.0 | 5 votes |
@Test public void testContinuationsIgnored() throws Exception { HttpServletRequest httpRequest = EasyMock.createMock(HttpServletRequest.class); ServiceInfo serviceInfo = new ServiceInfo(); serviceInfo.setName(new QName("bla", "Service")); EndpointInfo ei = new EndpointInfo(serviceInfo, ""); ei.setName(new QName("bla", "Port")); final UndertowHTTPServerEngine httpEngine = new UndertowHTTPServerEngine(); httpEngine.setContinuationsEnabled(false); UndertowHTTPServerEngineFactory factory = new UndertowHTTPServerEngineFactory() { @Override public UndertowHTTPServerEngine retrieveUndertowHTTPServerEngine(int port) { return httpEngine; } }; Bus b2 = new ExtensionManagerBus(); transportFactory = new HTTPTransportFactory(); b2.setExtension(factory, UndertowHTTPServerEngineFactory.class); TestUndertowDestination testDestination = new TestUndertowDestination(b2, transportFactory.getRegistry(), ei, factory); testDestination.finalizeConfig(); Message mi = testDestination.retrieveFromContinuation(httpRequest); assertNull("Continuations must be ignored", mi); }
Example 14
Source File: ApplicationContextTest.java From cxf with Apache License 2.0 | 5 votes |
private EndpointInfo getEndpointInfo(String serviceNS, String endpointLocal, String address) { ServiceInfo serviceInfo2 = new ServiceInfo(); serviceInfo2.setName(new QName(serviceNS, "Service")); EndpointInfo info2 = new EndpointInfo(serviceInfo2, ""); info2.setName(new QName("urn:test:ns", endpointLocal)); info2.setAddress(address); return info2; }
Example 15
Source File: JettyHTTPDestinationTest.java From cxf with Apache License 2.0 | 5 votes |
@Test public void testContinuationsIgnored() throws Exception { HttpServletRequest httpRequest = EasyMock.createMock(HttpServletRequest.class); ServiceInfo serviceInfo = new ServiceInfo(); serviceInfo.setName(new QName("bla", "Service")); EndpointInfo ei = new EndpointInfo(serviceInfo, ""); ei.setName(new QName("bla", "Port")); final JettyHTTPServerEngine httpEngine = new JettyHTTPServerEngine(); httpEngine.setContinuationsEnabled(false); JettyHTTPServerEngineFactory factory = new JettyHTTPServerEngineFactory() { @Override public JettyHTTPServerEngine retrieveJettyHTTPServerEngine(int port) { return httpEngine; } }; Bus b2 = new ExtensionManagerBus(); transportFactory = new HTTPTransportFactory(); b2.setExtension(factory, JettyHTTPServerEngineFactory.class); TestJettyDestination testDestination = new TestJettyDestination(b2, transportFactory.getRegistry(), ei, factory); testDestination.finalizeConfig(); Message mi = testDestination.retrieveFromContinuation(httpRequest); assertNull("Continuations must be ignored", mi); }
Example 16
Source File: JettyHTTPDestinationTest.java From cxf with Apache License 2.0 | 5 votes |
@Test public void testRandomPortAllocation() throws Exception { bus = BusFactory.getDefaultBus(true); transportFactory = new HTTPTransportFactory(); ServiceInfo serviceInfo = new ServiceInfo(); serviceInfo.setName(new QName("bla", "Service")); EndpointInfo ei = new EndpointInfo(serviceInfo, ""); ei.setName(new QName("bla", "Port")); Destination d1 = transportFactory.getDestination(ei, bus); URL url = new URL(d1.getAddress().getAddress().getValue()); assertTrue("No random port has been allocated", url.getPort() > 0); }
Example 17
Source File: ApplicationContextTest.java From cxf with Apache License 2.0 | 5 votes |
private EndpointInfo getEndpointInfo(String serviceNS, String endpointLocal, String address) { ServiceInfo serviceInfo2 = new ServiceInfo(); serviceInfo2.setName(new QName(serviceNS, "Service")); EndpointInfo info2 = new EndpointInfo(serviceInfo2, ""); info2.setName(new QName("urn:test:ns", endpointLocal)); info2.setAddress(address); return info2; }
Example 18
Source File: ManagedRMManagerTest.java From cxf with Apache License 2.0 | 5 votes |
private Endpoint createTestEndpoint() throws Exception { ServiceInfo svci = new ServiceInfo(); svci.setName(new QName(TEST_URI, "testService")); Service svc = new ServiceImpl(svci); SoapBindingInfo binding = new SoapBindingInfo(svci, WSDLConstants.NS_SOAP11); binding.setTransportURI(WSDLConstants.NS_SOAP_HTTP_TRANSPORT); EndpointInfo ei = new EndpointInfo(); ei.setAddress(TEST_URI); ei.setName(new QName(TEST_URI, "testPort")); ei.setBinding(binding); ei.setService(svci); return new EndpointImpl(bus, svc, ei); }
Example 19
Source File: JAXRSServiceImpl.java From cxf with Apache License 2.0 | 5 votes |
public List<ServiceInfo> getServiceInfos() { if (!createServiceModel) { return Collections.emptyList(); } // try to convert to WSDL-centric model so that CXF DataBindings can get initialized // might become useful too if we support wsdl2 // make databindings to use databinding-specific information // like @XmlRootElement for ex to select a namespace this.put("org.apache.cxf.databinding.namespace", "true"); List<ServiceInfo> infos = new ArrayList<>(); for (ClassResourceInfo cri : classResourceInfos) { ServiceInfo si = new ServiceInfo(); infos.add(si); QName qname = JAXRSUtils.getClassQName(cri.getServiceClass()); si.setName(qname); InterfaceInfo inf = new InterfaceInfo(si, qname); si.setInterface(inf); for (OperationResourceInfo ori : cri.getMethodDispatcher().getOperationResourceInfos()) { Method m = ori.getMethodToInvoke(); QName oname = new QName(qname.getNamespaceURI(), m.getName()); OperationInfo oi = inf.addOperation(oname); createMessagePartInfo(oi, m.getReturnType(), qname, m, false); for (Parameter pm : ori.getParameters()) { if (pm.getType() == ParameterType.REQUEST_BODY) { createMessagePartInfo(oi, ori.getMethodToInvoke().getParameterTypes()[pm.getIndex()], qname, m, true); } } } } return infos; }
Example 20
Source File: ReflectionServiceFactoryBean.java From cxf with Apache License 2.0 | 4 votes |
protected void buildServiceFromClass() { Object o = getBus().getProperty("requireExplicitContractLocation"); if (o != null && ("true".equals(o) || Boolean.TRUE.equals(o))) { throw new ServiceConstructionException(new Message("NO_WSDL_PROVIDED", LOG, getServiceClass().getName())); } if (LOG.isLoggable(Level.INFO)) { LOG.info("Creating Service " + getServiceQName() + " from class " + getServiceClass().getName()); } populateFromClass = true; if (Proxy.isProxyClass(this.getServiceClass())) { LOG.log(Level.WARNING, "USING_PROXY_FOR_SERVICE", getServiceClass()); } sendEvent(Event.CREATE_FROM_CLASS, getServiceClass()); ServiceInfo serviceInfo = new ServiceInfo(); SchemaCollection col = serviceInfo.getXmlSchemaCollection(); col.getXmlSchemaCollection().setSchemaResolver(new CatalogXmlSchemaURIResolver(this.getBus())); col.getExtReg().registerSerializer(MimeAttribute.class, new MimeSerializer()); ServiceImpl service = new ServiceImpl(serviceInfo); setService(service); setServiceProperties(); serviceInfo.setName(getServiceQName()); serviceInfo.setTargetNamespace(serviceInfo.getName().getNamespaceURI()); sendEvent(Event.SERVICE_SET, getService()); createInterface(serviceInfo); Set<?> wrapperClasses = this.getExtraClass(); for (ServiceInfo si : getService().getServiceInfos()) { if (wrapperClasses != null && !wrapperClasses.isEmpty()) { si.setProperty(EXTRA_CLASS, wrapperClasses); } } initializeDataBindings(); boolean isWrapped = isWrapped() || hasWrappedMethods(serviceInfo.getInterface()); if (isWrapped) { initializeWrappedSchema(serviceInfo); } for (OperationInfo opInfo : serviceInfo.getInterface().getOperations()) { Method m = (Method)opInfo.getProperty(METHOD); if (!isWrapped(m) && !isRPC(m) && opInfo.getInput() != null) { createBareMessage(serviceInfo, opInfo, false); } if (!isWrapped(m) && !isRPC(m) && opInfo.getOutput() != null) { createBareMessage(serviceInfo, opInfo, true); } if (opInfo.hasFaults()) { // check to make sure the faults are elements for (FaultInfo fault : opInfo.getFaults()) { QName qn = (QName)fault.getProperty("elementName"); MessagePartInfo part = fault.getFirstMessagePart(); if (!part.isElement()) { part.setElement(true); part.setElementQName(qn); checkForElement(serviceInfo, part); } } } } if (LOG.isLoggable(Level.FINE) || isValidate()) { ServiceModelSchemaValidator validator = new ServiceModelSchemaValidator(serviceInfo); validator.walk(); String validationComplaints = validator.getComplaints(); if (!"".equals(validationComplaints)) { if (isValidate()) { LOG.warning(validationComplaints); } else { LOG.fine(validationComplaints); } } } }