use of org.apache.cxf.aegis.type.AegisType in project cxf by apache.
the class ConfigurationTest method testExtensibleDefaultTrue.
@Test
public void testExtensibleDefaultTrue() throws Exception {
config.setDefaultExtensibleElements(true);
config.setDefaultExtensibleAttributes(true);
AegisType type = tm.getTypeCreator().createType(AnnotatedBean1.class);
BeanTypeInfo info = ((BeanType) type).getTypeInfo();
assertTrue(info.isExtensibleElements());
assertTrue(info.isExtensibleAttributes());
}
use of org.apache.cxf.aegis.type.AegisType in project cxf by apache.
the class MapTest method testRecursiveType.
@Test
public void testRecursiveType() throws Exception {
Method m = MapService.class.getMethod("getMapOfCollections", new Class[0]);
AegisType type = creator.createType(m, -1);
tm.register(type);
assertTrue(type instanceof MapType);
MapType mapType = (MapType) type;
QName keyName = mapType.getKeyName();
assertNotNull(keyName);
type = mapType.getKeyType();
assertNotNull(type);
assertTrue(type instanceof CollectionType);
assertEquals(String.class, ((CollectionType) type).getComponentType().getTypeClass());
type = mapType.getValueType();
assertNotNull(type);
assertTrue(type instanceof CollectionType);
assertEquals(Double.class, ((CollectionType) type).getComponentType().getTypeClass());
}
use of org.apache.cxf.aegis.type.AegisType in project cxf by apache.
the class TestDateMapping method testWriteSqlDateAsDate.
@Test
public void testWriteSqlDateAsDate() throws Exception {
context = new AegisContext();
Set<java.lang.reflect.Type> rootClasses = new HashSet<>();
rootClasses.add(BeanWithDate.class);
context.setRootClasses(rootClasses);
context.initialize();
BeanWithDate bean = new BeanWithDate();
java.sql.Date date = new java.sql.Date(0);
bean.setFig(date);
AegisType sbType = context.getTypeMapping().getType(bean.getClass());
AegisWriter<XMLStreamWriter> writer = context.createXMLStreamWriter();
StringWriter stringWriter = new StringWriter();
XMLStreamWriter xmlWriter = xmlOutputFactory.createXMLStreamWriter(stringWriter);
writer.write(bean, new QName("urn:test", "beanWithDate"), false, xmlWriter, sbType);
xmlWriter.close();
// an absence of exception is success here.
}
use of org.apache.cxf.aegis.type.AegisType in project cxf by apache.
the class XmlParamTypeTest method testType.
@Test
public void testType() throws Exception {
Method m = CustomTypeService.class.getMethod("doFoo", new Class[] { String.class });
AegisType type = creator.createType(m, 0);
tm.register(type);
assertTrue(type instanceof CustomStringType);
// assertEquals(new QName("urn:xfire:foo", "custom"), type.getSchemaType());
type = creator.createType(m, -1);
tm.register(type);
assertTrue(type instanceof CustomStringType);
assertEquals(new QName("urn:xfire:foo", "custom"), type.getSchemaType());
}
use of org.apache.cxf.aegis.type.AegisType in project cxf by apache.
the class EnumTypeTest method testNillable.
@Test
public void testNillable() throws Exception {
AegisType type = tm.getTypeCreator().createType(EnumBean.class);
tm.register(type);
Element root = writeObjectToElement(type, new EnumBean(), getContext());
ElementReader reader = new ElementReader(StaxUtils.createXMLStreamReader(root));
Object value = type.readObject(reader, getContext());
assertTrue(value instanceof EnumBean);
EnumBean bean = (EnumBean) value;
assertNull(bean.getCurrency());
}
Aggregations