Search in sources :

Example 36 with ExtensionManagerBus

use of org.apache.cxf.bus.extension.ExtensionManagerBus in project cxf by apache.

the class CXFBusImplTest method testConstructionWithoutExtensions.

@Test
public void testConstructionWithoutExtensions() throws BusException {
    Bus bus = new ExtensionManagerBus();
    assertNotNull(bus.getExtension(BindingFactoryManager.class));
    assertNotNull(bus.getExtension(ConduitInitiatorManager.class));
    assertNotNull(bus.getExtension(DestinationFactoryManager.class));
    assertNotNull(bus.getExtension(PhaseManager.class));
    bus.shutdown(true);
}
Also used : Bus(org.apache.cxf.Bus) ExtensionManagerBus(org.apache.cxf.bus.extension.ExtensionManagerBus) DestinationFactoryManager(org.apache.cxf.transport.DestinationFactoryManager) PhaseManager(org.apache.cxf.phase.PhaseManager) ConduitInitiatorManager(org.apache.cxf.transport.ConduitInitiatorManager) BindingFactoryManager(org.apache.cxf.binding.BindingFactoryManager) ExtensionManagerBus(org.apache.cxf.bus.extension.ExtensionManagerBus) Test(org.junit.Test)

Example 37 with ExtensionManagerBus

use of org.apache.cxf.bus.extension.ExtensionManagerBus in project cxf by apache.

the class CXFBusFactory method createBus.

public Bus createBus(Map<Class<?>, Object> e, Map<String, Object> properties) {
    ExtensionManagerBus bus = new ExtensionManagerBus(e, properties);
    possiblySetDefaultBus(bus);
    initializeBus(bus);
    bus.initialize();
    return bus;
}
Also used : ExtensionManagerBus(org.apache.cxf.bus.extension.ExtensionManagerBus)

Example 38 with ExtensionManagerBus

use of org.apache.cxf.bus.extension.ExtensionManagerBus in project cxf by apache.

the class JAXBDataBindingTest method testResursiveType.

@Test
public void testResursiveType() throws Exception {
    Set<Class<?>> classes = new HashSet<>();
    Collection<Object> typeReferences = new ArrayList<>();
    Map<String, Object> props = new HashMap<>();
    Bus b = new ExtensionManagerBus();
    b.setExtension(new ASMHelperImpl(), ASMHelper.class);
    FactoryClassCreator extr = new FactoryClassProxyService(b);
    b.setExtension(extr, FactoryClassCreator.class);
    JAXBContextInitializer init = new JAXBContextInitializer(b, null, classes, typeReferences, props);
    init.addClass(Type2.class);
    assertEquals(2, classes.size());
}
Also used : Bus(org.apache.cxf.Bus) ExtensionManagerBus(org.apache.cxf.bus.extension.ExtensionManagerBus) ASMHelperImpl(org.apache.cxf.common.util.ASMHelperImpl) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) ExtensionManagerBus(org.apache.cxf.bus.extension.ExtensionManagerBus) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 39 with ExtensionManagerBus

use of org.apache.cxf.bus.extension.ExtensionManagerBus in project cxf by apache.

the class JAXBEncoderDecoderTest method testCustomNamespaces.

@Test
public void testCustomNamespaces() throws Exception {
    Map<String, String> mapper = new HashMap<>();
    mapper.put("http://apache.org/hello_world_soap_http/types", "Omnia");
    mapper.put("http://cxf.apache.org/jaxb_form", "Gallia");
    ObjectWithQualifiedElementElement testObject = new ObjectWithQualifiedElementElement();
    testObject.setString1("twine");
    testObject.setString2("cord");
    QName elName = new QName(wrapperAnnotation.targetNamespace(), wrapperAnnotation.localName());
    MessagePartInfo part = new MessagePartInfo(elName, null);
    part.setElement(true);
    part.setElementQName(elName);
    StringWriter stringWriter = new StringWriter();
    XMLOutputFactory opFactory = XMLOutputFactory.newInstance();
    opFactory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, Boolean.TRUE);
    XMLEventWriter writer = opFactory.createXMLEventWriter(stringWriter);
    Marshaller m = context.createMarshaller();
    Bus bus = new ExtensionManagerBus();
    JAXBUtils.setNamespaceMapper(bus, mapper, m);
    JAXBEncoderDecoder.marshall(m, testObject, part, writer);
    writer.flush();
    writer.close();
    String xmlResult = stringWriter.toString();
    // the following is a bit of a crock, but, to tell the truth, this test case most exists
    // so that it could be examined inside the debugger to see how JAXB works.
    assertTrue(xmlResult.contains("Gallia:string2"));
}
Also used : Bus(org.apache.cxf.Bus) ExtensionManagerBus(org.apache.cxf.bus.extension.ExtensionManagerBus) XMLOutputFactory(javax.xml.stream.XMLOutputFactory) Marshaller(javax.xml.bind.Marshaller) ObjectWithQualifiedElementElement(org.apache.cxf.jaxb_form.ObjectWithQualifiedElementElement) StringWriter(java.io.StringWriter) HashMap(java.util.HashMap) XMLEventWriter(javax.xml.stream.XMLEventWriter) QName(javax.xml.namespace.QName) MessagePartInfo(org.apache.cxf.service.model.MessagePartInfo) ExtensionManagerBus(org.apache.cxf.bus.extension.ExtensionManagerBus) Test(org.junit.Test)

Example 40 with ExtensionManagerBus

use of org.apache.cxf.bus.extension.ExtensionManagerBus in project cxf by apache.

the class UndertowHTTPDestinationTest method testContinuationsIgnored.

@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);
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) ServiceInfo(org.apache.cxf.service.model.ServiceInfo) EndpointInfo(org.apache.cxf.service.model.EndpointInfo) Bus(org.apache.cxf.Bus) ExtensionManagerBus(org.apache.cxf.bus.extension.ExtensionManagerBus) Message(org.apache.cxf.message.Message) QName(javax.xml.namespace.QName) HTTPTransportFactory(org.apache.cxf.transport.http.HTTPTransportFactory) ExtensionManagerBus(org.apache.cxf.bus.extension.ExtensionManagerBus) Test(org.junit.Test)

Aggregations

ExtensionManagerBus (org.apache.cxf.bus.extension.ExtensionManagerBus)59 Bus (org.apache.cxf.Bus)48 Test (org.junit.Test)44 EndpointInfo (org.apache.cxf.service.model.EndpointInfo)28 Message (org.apache.cxf.message.Message)14 HTTPTransportFactory (org.apache.cxf.transport.http.HTTPTransportFactory)14 QName (javax.xml.namespace.QName)8 DestinationRegistry (org.apache.cxf.transport.http.DestinationRegistry)8 ServiceInfo (org.apache.cxf.service.model.ServiceInfo)7 ArrayList (java.util.ArrayList)6 AtmosphereInterceptor (org.atmosphere.cpr.AtmosphereInterceptor)6 HashMap (java.util.HashMap)5 HashSet (java.util.HashSet)5 URL (java.net.URL)4 List (java.util.List)4 ASMHelperImpl (org.apache.cxf.common.util.ASMHelperImpl)4 MessageObserver (org.apache.cxf.transport.MessageObserver)4 HTTPServerPolicy (org.apache.cxf.transports.http.configuration.HTTPServerPolicy)4 HttpURLConnection (java.net.HttpURLConnection)3 Hashtable (java.util.Hashtable)3