Search in sources :

Example 11 with BeanType

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")));
}
Also used : BeanTypeInfo(org.apache.cxf.aegis.type.basic.BeanTypeInfo) AegisType(org.apache.cxf.aegis.type.AegisType) BeanType(org.apache.cxf.aegis.type.basic.BeanType) QName(javax.xml.namespace.QName) Test(org.junit.Test) AbstractAegisTest(org.apache.cxf.aegis.AbstractAegisTest)

Example 12 with BeanType

use of org.apache.cxf.aegis.type.basic.BeanType in project cxf by apache.

the class ConfigurationTest method testMinOccursDefault1.

@Test
public void testMinOccursDefault1() throws Exception {
    config.setDefaultMinOccurs(1);
    AegisType type = tm.getTypeCreator().createType(AnnotatedBean1.class);
    BeanTypeInfo info = ((BeanType) type).getTypeInfo();
    assertEquals(info.getMinOccurs(new QName(info.getDefaultNamespace(), "bogusProperty")), 1);
}
Also used : BeanTypeInfo(org.apache.cxf.aegis.type.basic.BeanTypeInfo) AegisType(org.apache.cxf.aegis.type.AegisType) BeanType(org.apache.cxf.aegis.type.basic.BeanType) QName(javax.xml.namespace.QName) Test(org.junit.Test) AbstractAegisTest(org.apache.cxf.aegis.AbstractAegisTest)

Example 13 with BeanType

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());
}
Also used : BeanType(org.apache.cxf.aegis.type.basic.BeanType) QName(javax.xml.namespace.QName) TypeCreationOptions(org.apache.cxf.aegis.type.TypeCreationOptions) Test(org.junit.Test) AbstractAegisTest(org.apache.cxf.aegis.AbstractAegisTest)

Example 14 with BeanType

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());
}
Also used : BeanType(org.apache.cxf.aegis.type.basic.BeanType) QName(javax.xml.namespace.QName) Test(org.junit.Test) AbstractAegisTest(org.apache.cxf.aegis.AbstractAegisTest)

Example 15 with BeanType

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());
}
Also used : BeanType(org.apache.cxf.aegis.type.basic.BeanType) Test(org.junit.Test) AbstractAegisTest(org.apache.cxf.aegis.AbstractAegisTest)

Aggregations

BeanType (org.apache.cxf.aegis.type.basic.BeanType)26 AbstractAegisTest (org.apache.cxf.aegis.AbstractAegisTest)19 Test (org.junit.Test)19 QName (javax.xml.namespace.QName)17 AegisType (org.apache.cxf.aegis.type.AegisType)8 BeanTypeInfo (org.apache.cxf.aegis.type.basic.BeanTypeInfo)8 TypeCreationOptions (org.apache.cxf.aegis.type.TypeCreationOptions)3 MessageWriter (org.apache.cxf.aegis.xml.MessageWriter)2 GenericArrayType (java.lang.reflect.GenericArrayType)1 ParameterizedType (java.lang.reflect.ParameterizedType)1 AegisContext (org.apache.cxf.aegis.AegisContext)1 DatabindingException (org.apache.cxf.aegis.DatabindingException)1 TypeMapping (org.apache.cxf.aegis.type.TypeMapping)1 TypeUtil (org.apache.cxf.aegis.type.TypeUtil)1 XMLBeanTypeInfo (org.apache.cxf.aegis.type.basic.XMLBeanTypeInfo)1 XmlSchema (org.apache.ws.commons.schema.XmlSchema)1 Element (org.w3c.dom.Element)1