use of org.apache.cxf.aegis.services.AttributeBean 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.services.AttributeBean 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);
}
Aggregations