use of org.apache.cxf.aegis.AegisContext in project cxf by apache.
the class QualificationTest method testAnnotatedDefaultQualifiedAttribute.
@Test
public void testAnnotatedDefaultQualifiedAttribute() throws Exception {
AegisContext context = new AegisContext();
TypeCreationOptions typeCreationOptions = new TypeCreationOptions();
typeCreationOptions.setQualifyAttributes(true);
context.setTypeCreationOptions(typeCreationOptions);
context.initialize();
TypeMapping mapping = context.getTypeMapping();
AegisType type = mapping.getTypeCreator().createType(AttributeBean.class);
type.setSchemaType(new QName("urn:Bean", "bean"));
Context messageContext = new Context(context);
AttributeBean bean = new AttributeBean();
Element element = writeObjectToElement(type, bean, messageContext);
assertValid("/b:root[@xyzzy:attrExplicitString]", element);
assertXPathEquals("/b:root/@xyzzy:attrExplicitString", "attrExplicit", element);
assertValid("/b:root[@pkg:attrPlainString]", element);
assertXPathEquals("/b:root/@pkg:attrPlainString", "attrPlain", element);
}
use of org.apache.cxf.aegis.AegisContext in project cxf by apache.
the class QualificationTest method testAnnotatedDefaultUnqualifiedAttribute.
@Test
public void testAnnotatedDefaultUnqualifiedAttribute() throws Exception {
AegisContext context = new AegisContext();
context.initialize();
TypeMapping mapping = context.getTypeMapping();
AegisType type = mapping.getTypeCreator().createType(AttributeBean.class);
type.setSchemaType(new QName("urn:Bean", "bean"));
Context messageContext = new Context(context);
AttributeBean bean = new AttributeBean();
Element element = writeObjectToElement(type, bean, messageContext);
assertValid("/b:root[@xyzzy:attrExplicitString]", element);
assertXPathEquals("/b:root/@xyzzy:attrExplicitString", "attrExplicit", element);
assertValid("/b:root[@attrPlainString]", element);
assertXPathEquals("/b:root/@attrPlainString", "attrPlain", element);
}
use of org.apache.cxf.aegis.AegisContext in project cxf by apache.
the class AbstractEncodedTest method getContext.
protected Context getContext() {
AegisContext globalContext = new AegisContext();
globalContext.initialize();
globalContext.setTypeMapping(mapping);
return new Context(globalContext);
}
use of org.apache.cxf.aegis.AegisContext in project cxf by apache.
the class ArrayTypeInfoTest method setUp.
public void setUp() throws Exception {
super.setUp();
addNamespace("b", "urn:Bean");
addNamespace("a", "urn:anotherns");
addNamespace("xsi", Constants.URI_2001_SCHEMA_XSI);
AegisContext context = new AegisContext();
context.initialize();
mapping = context.getTypeMapping();
// address type
BeanTypeInfo addressInfo = new BeanTypeInfo(Address.class, "urn:Bean");
addressInfo.setTypeMapping(mapping);
addressType = new StructType(addressInfo);
addressType.setTypeClass(Address.class);
addressType.setSchemaType(new QName("urn:Bean", "addr"));
mapping.register(addressType);
}
use of org.apache.cxf.aegis.AegisContext in project cxf by apache.
the class ClassTest method startServer.
@Before
public void startServer() throws Exception {
AegisContext context = new AegisContext();
context.initialize();
context.getTypeMapping().register(new ClassAsStringType());
ServerFactoryBean b = new ServerFactoryBean();
b.setDataBinding(new AegisDatabinding(context));
b.setServiceClass(GenericsService.class);
b.setAddress("local://GenericsService");
server = b.create();
}
Aggregations