Search in sources :

Example 1 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 2 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 3 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)

Example 4 with BeanType

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));
    }
}
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 5 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)

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 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