use of org.apache.cxf.aegis.AegisContext in project cxf by apache.
the class QualificationTest method testXmlDefaultUnqualifiedAttribute.
@Test
public void testXmlDefaultUnqualifiedAttribute() throws Exception {
AegisContext context = new AegisContext();
context.initialize();
TypeMapping mapping = context.getTypeMapping();
AegisType type = mapping.getTypeCreator().createType(XmlMappedAttributeBean.class);
type.setSchemaType(new QName("urn:Bean", "bean"));
Context messageContext = new Context(context);
XmlMappedAttributeBean bean = new XmlMappedAttributeBean();
Element element = writeObjectToElement(type, bean, messageContext);
assertValid("/b:root[@attrXmlString]", element);
assertXPathEquals("/b:root/@attrXmlString", "attrXml", element);
}
use of org.apache.cxf.aegis.AegisContext in project cxf by apache.
the class AbstractEncodedTest method setUp.
@Before
public void setUp() throws Exception {
super.setUp();
addNamespace("b", "urn:Bean");
addNamespace("a", "urn:anotherns");
addNamespace("xsi", Constants.URI_2001_SCHEMA_XSI);
addNamespace("soapenc", Soap11.getInstance().getSoapEncodingStyle());
AegisContext context = new AegisContext();
// create a different mapping than the context creates.
TypeMapping baseMapping = DefaultTypeMapping.createSoap11TypeMapping(true, false, false);
mapping = new DefaultTypeMapping(Constants.URI_2001_SCHEMA_XSD, baseMapping);
mapping.setTypeCreator(context.createTypeCreator());
context.setTypeMapping(mapping);
context.initialize();
// serialization root type
trailingBlocks = new TrailingBlocks();
}
use of org.apache.cxf.aegis.AegisContext in project cxf by apache.
the class CustomMappingTest method testInheritedMapping.
@Test
public void testInheritedMapping() throws Exception {
BeanTypeInfo bti = new BeanTypeInfo(GregorianCalendar.class, "http://util.java");
BeanType beanType = new BeanType(bti);
beanType.setSchemaType(new QName("http://util.java{GregorianCalendar}"));
AegisContext context = new AegisContext();
context.initialize();
TypeMapping mapping = context.getTypeMapping();
// we are replacing the default mapping.
mapping.register(beanType);
XmlSchema schema = newXmlSchema("http://util.java");
beanType.writeSchema(schema);
// well, test?
}
use of org.apache.cxf.aegis.AegisContext in project cxf by apache.
the class ExceptionInheritanceTest method setUp.
public void setUp() throws Exception {
super.setUp();
AegisContext globalContext = new AegisContext();
globalContext.setWriteXsiTypes(true);
Set<String> l = new HashSet<>();
l.add(SimpleBean.class.getName());
l.add(WS1ExtendedException.class.getName());
globalContext.setRootClassNames(l);
AegisDatabinding binding = new AegisDatabinding();
binding.setAegisContext(globalContext);
ClientProxyFactoryBean pf = new ClientProxyFactoryBean();
setupAegis(pf.getClientFactoryBean(), binding);
pf.getServiceFactory().setProperties(props);
pf.setAddress("local://WS1");
pf.setProperties(props);
client = pf.create(WS1.class);
Server server = createService(WS1.class, new WS1Impl(), "WS1", binding);
server.getEndpoint().getService().setInvoker(new BeanInvoker(new WS1Impl()));
}
use of org.apache.cxf.aegis.AegisContext in project cxf by apache.
the class InheritancePOJOTest method setUp.
@Before
public void setUp() throws Exception {
super.setUp();
ServerFactoryBean sf = createServiceFactory(InheritanceService.class, null, "InheritanceService", new QName("urn:xfire:inheritance", "InheritanceService"), null);
AegisContext globalContext = new AegisContext();
globalContext.setWriteXsiTypes(true);
Set<String> l = new HashSet<>();
l.add(Employee.class.getName());
globalContext.setRootClassNames(l);
AegisDatabinding binding = new AegisDatabinding();
binding.setAegisContext(globalContext);
sf.getServiceFactory().setDataBinding(binding);
sf.create();
}
Aggregations