use of org.apache.cxf.aegis.type.basic.BeanType in project cxf by apache.
the class JaxbTypeTest method testAegisType.
/**
* Test if attributeProperty is correctly mapped to attProp by
* applying the xml mapping file <className>.aegis.xml
*/
@Test
public void testAegisType() {
BeanType type = (BeanType) tm.getTypeCreator().createType(JaxbBean3.class);
assertEquals(0, type.getTypeInfo().getAttributes().size());
Iterator<QName> itr = type.getTypeInfo().getElements().iterator();
assertTrue(itr.hasNext());
QName q = itr.next();
assertEquals("attProp", q.getLocalPart());
}
use of org.apache.cxf.aegis.type.basic.BeanType in project cxf by apache.
the class JaxbTypeTest method testGetSetRequired.
@Test
public void testGetSetRequired() throws Exception {
BeanType type = new BeanType(new AnnotatedTypeInfo(tm, BadBean.class, "urn:foo", new TypeCreationOptions()));
type.setSchemaType(new QName("urn:foo", "BadBean"));
assertEquals(0, type.getTypeInfo().getElements().size());
}
use of org.apache.cxf.aegis.type.basic.BeanType in project cxf by apache.
the class JaxbTypeTest method testExtensibilityOff.
@Test
public void testExtensibilityOff() {
BeanType type = (BeanType) tm.getTypeCreator().createType(JaxbBean4.class);
assertFalse(type.getTypeInfo().isExtensibleElements());
assertFalse(type.getTypeInfo().isExtensibleAttributes());
}
use of org.apache.cxf.aegis.type.basic.BeanType in project cxf by apache.
the class JaxbTypeTest method testNillableAndMinOccurs.
@Test
public void testNillableAndMinOccurs() {
BeanType type = (BeanType) tm.getTypeCreator().createType(JaxbBean4.class);
AnnotatedTypeInfo info = (AnnotatedTypeInfo) type.getTypeInfo();
Iterator<QName> elements = info.getElements().iterator();
assertTrue(elements.hasNext());
// nillable first
QName element = elements.next();
if ("minOccursProperty".equals(element.getLocalPart())) {
assertEquals(1, info.getMinOccurs(element));
} else {
assertFalse(info.isNillable(element));
}
assertTrue(elements.hasNext());
// minOccurs = 1 second
element = elements.next();
if ("minOccursProperty".equals(element.getLocalPart())) {
assertEquals(1, info.getMinOccurs(element));
} else {
assertFalse(info.isNillable(element));
}
}
use of org.apache.cxf.aegis.type.basic.BeanType in project cxf by apache.
the class ConfigurationTest method testNillableDefaultTrue.
@Test
public void testNillableDefaultTrue() throws Exception {
config.setDefaultNillable(true);
AegisType type = tm.getTypeCreator().createType(AnnotatedBean1.class);
BeanTypeInfo info = ((BeanType) type).getTypeInfo();
assertTrue(info.isNillable(new QName(info.getDefaultNamespace(), "bogusProperty")));
}
Aggregations