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);
}
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;
}
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());
}
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"));
}
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);
}
Aggregations